TaxonController¶
- class pyinaturalist.controllers.TaxonController(client)¶
Bases:
BaseController
Controller for Taxon requests
Methods
- __call__(taxon_id, **kwargs)¶
Get a single taxon by ID
Example
>>> client.taxa(343248)
- __init__(client)¶
- autocomplete(**params)¶
Given a query string, return taxa with names starting with the search term
Notes
API reference: GET /taxa/autocomplete
There appears to currently be a bug in the API that causes
per_page
to not have any effect.
- Parameters:
taxon_id (
Optional
[int
]) – Only show taxa with this ID, or its descendantsmin_rank (
Optional
[str
]) – Taxon must have this rank or higher; overridesrank
max_rank (
Optional
[str
]) – Taxon must have this rank or lower; overridesrank
rank_level (
Optional
[int
]) – Taxon must have this rank level. Some example values are 70 (kingdom), 60 (phylum), 50 (class), 40 (order), 30 (family), 20 (genus), 10 (species), 5 (subspecies)locale (
Optional
[str
]) – Locale preference for taxon common namespreferred_place_id (
Optional
[int
]) – Place preference for regional taxon common namesall_names (
Optional
[bool
]) – Include all taxon names in the response
Example
>>> client.taxa.autocomplete(q='vespi')
- from_ids(taxon_ids, **params)¶
Get one or more taxa by ID
Notes
API reference: GET /taxa/{id}
Example
>>> client.get_taxa_by_id([3, 343248])
- populate(taxon, **params)¶
Update a partial Taxon record with full taxonomy info, including ancestors + children
- search(**params)¶
Search taxa
Notes
API reference: GET /taxa
- Parameters:
taxon_id (
Optional
[int
]) – Only show taxa with this ID, or its descendantsmin_rank (
Optional
[str
]) – Taxon must have this rank or higher; overridesrank
max_rank (
Optional
[str
]) – Taxon must have this rank or lower; overridesrank
rank_level (
Optional
[int
]) – Taxon must have this rank level. Some example values are 70 (kingdom), 60 (phylum), 50 (class), 40 (order), 30 (family), 20 (genus), 10 (species), 5 (subspecies)locale (
Optional
[str
]) – Locale preference for taxon common namespreferred_place_id (
Optional
[int
]) – Place preference for regional taxon common namesall_names (
Optional
[bool
]) – Include all taxon names in the responseparent_id (
Optional
[int
]) – Taxon’s parent must have this ID
Example
>>> client.taxa.search(q='vespi', rank=['genus', 'family'])