Package: pykew
Library for easy access to Kew’s nomenclatural and taxonomic services. Hides the
intricacies of using the HTTP API.IPNIModule for searching IPNI data and looking up individual records.Simple searchimportpykew.ipniasipniresult=ipni.search('Poa annua')Advanced searchimportpykew.ipniasipnifrompykew.ipni_termsimportNamequery={Name.genus:'Poa',Name.species:'annua'}res=ipni.search(query)Available Search TermsTo build complex queries, use the search terms available inipni_terms. Query term are grouped into
the modulesName,Author, andPublication.Nameaddedauthorbasionymbasionym_authorbibliographic_referencecitation_typecollection_numbercollectorsdistributionfamilyfull_namegenusin_powoinfrafamilyinfragenusinfraspeciesmodifiedname_statuspublishedpublished_inpublishing_authorrankscientific_namespeciesspecies_authorversionAuthorforenamefull_namestandard_formsurnamePublicationstandard_formbph_numberdateisbnissnlc_numberpreceded_bysuperceded_bytitletl2_authortl2_numberFilteringYou can filter a given result set by taxonomic rank.importpykew.ipniasipnifrompykew.ipni_termsimportFiltersres=ipni.search('Poa',filters=Filters.infraspecific)Available FiltersFiltersfamilialinfrafamilialgenericinfragenericspecificinfraspecificUsing resultsResults sets are returned as an iterator which can be manipulated as you generally would in python. The result object
also implementssize()efficiently - it does not fetch all results to count them.importpykew.ipniasipnifrompykew.ipni_termsimportNamequery={Name.genus:'Poa',Name.species:'annua'}res=ipni.search(query)res.size()[r['name']forrinresif'name'inr]POWOModule for searching POWO data and looking up individual records. Taxonomic data is
returned by default, but other associated such as distributions and descriptive text can
also be retrieved.Simple searchimportpykew.powoaspoworesult=powo.search('Poa annua')Advanced searchimportpykew.powoaspowofrompykew.powo_termsimportNamequery={Name.genus:'Poa',Name.species:'annua'}res=powo.search(query)Available Search TermsTo build complex queries, use the search terms available inpowo_terms. Query term are grouped into
the modulesName,Characteristic, andGeography.Namefull_namecommon_namekingdomfamilygenusspeciesauthorCharacteristicsummaryappearancecharacteristicflowerfruitleafinflorescenceseedcloninguseGeographydistributionFilteringYou can filter a given result set by accepted taxa, taxa with images, and taxonomic rank.importpykew.powoaspowofrompykew.powo_termsimportFiltersres=powo.search('Poa',filters=[Filters.accepted,Filters.species])Available FiltersFiltersacceptedhas_imagesfamiliesgeneraspeciesinfraspeciesIndividual recordimportpykew.powoaspowores=powo.lookup('urn:lsid:ipni.org:names:320035-2')Extra DataThe standard data returned by the POWO api includes taxonomic and nomenclatural information, but there
are other data you can request.Currently you can only retrieve distribution data, but other data should be exposed in the future.importpykew.powoaspowores=powo.lookup('urn:lsid:ipni.org:names:320035-2',include=['distribution'])native_to=[d['name']fordinres['distribution']['natives']]Using resultsResults sets are returned as an iterator which can be manipulated as you generally would in python. The result object
also implementssize()efficiently - it does not fetch all results to count them.importpykew.powoaspowofrompykew.powo_termsimportName,Geographyquery={Name.genus:'Poa',Geography.distribution:'Africa'}res=powo.search(query)res.size()[r['name']forrinresif'name'inr]