-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
19 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# flake8: noqa: F401 | ||
from pyinaturalist.controllers.base import BaseController, authenticated | ||
from pyinaturalist.controllers.observations import ObservationController | ||
from pyinaturalist.controllers.taxa import TaxonController |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import List | ||
|
||
from pyinaturalist.controllers import BaseController | ||
from pyinaturalist.docs import document_controller_params | ||
from pyinaturalist.models import Observation, Taxon | ||
from pyinaturalist.v1 import get_taxa | ||
|
||
|
||
class TaxonController(BaseController): | ||
"""Controller for taxon requests""" | ||
|
||
@document_controller_params(get_taxa) | ||
def search(self, **params) -> List[Observation]: | ||
response = get_taxa(**params, **self.client.settings) | ||
return Taxon.from_json_list(response) # type: ignore |