Package: ornitho
The following “ornitho controllers / calls” are implemented:taxonomic groupsList taxo groupsGet a single taxo groupfamiliesList familiesGet a single familyspeciesList speciesGet a single speciesterritorial unitsList territorial unitsGet a single territorial unitlocal admin unitsList local admin unitsGet a single local admin unitplacesList placesGet a single placeobserversList ObserversGet a single observerGet an observer rights listGet current observers infoentitiesList entitiesGet a single entityprotocolList protocolGet a single protocolGet list of sites for protocol idGet PDF for site idobservationsList observationsGet a single observationCreate an observationUpdate an observationsDelete an observationsSearch an observationSearch update or deletion since a given dateDelete a recordDelete a listfieldsList fieldsGet a single field optionsmediaGet a single mediaNot yet Implemented:local admin unitsSearch local admin unitsexport organizationsList export organizationsGet a single export organizationobservationsSearch closest observationsSearch last observationsSearch rare observationsSearch my observationsSearch observations from a list of observersSearch observations from a list of coordinatesSearch resources linked to an observationCreate a new resources for an observationimport filesList import filesGet a single import fileimport files/observationsList links for import files and observationsGet a single link between import file and observationvalidationsList validationsGet a single validationmortality informationList mortality informationsbearded vulture birdsList all bearded vulture birdsGet a single birdbearded vulture informationList bearded vulture informationsobservations by polygonList observations_by_polygonGet a single familyGet a single grouppolygonsGet a single polygonList polygons from a groupList polygon groupsList cache for a given polygon or group with a periodList form cache for a given polygon or group with a periodList species form cache for a given polygon or group with a periodList observer cache for a given polygon or groupList observer species cache for a given polygon or groupInstallingThe project is published onPyPI, and can be install using pip or any other
package manager:$ pip install ornithoManual installation can be done with following command:$ pip install .Optional caching dependency can be installed with$ pip install ornitho[caching]UsageBefore the client can be usedconsumer_key,consumer_secret,user_email,user_pwandapi_basemust
be set:importornithoornitho.consumer_key="CONSUMER_KEY"ornitho.consumer_secret="CONSUMER_SECRET"ornitho.user_email="USER_MAIL"ornitho.user_pw="USER_PASSWORD"ornitho.api_base="https://www.ornitho.de/api/"The client can then be used.CachingIf the additional caching dependency is installed, non chunked responses can be cached.
For activating the cache one has to set thecache_enabledflag.
Following settings are available:ornitho.cache_enabled=True# Enable/Disable cachingornitho.cache_name="ornitho_cache"# Name of the cacheornitho.cache_backend="redis"# Set caching backend, possible values: sqlite, memory, mongodb, redisornitho.cache_expire_after=600# Set expiration time for cached responsesFor more information see therequests-cache documentationExamplesFollowing code shows how to get all observation from ornitho.de between 01.10.2019 and 31.10.2019:importosimportornithoornitho.consumer_key=os.environ.get("ORNITHO_CONSUMER_KEY")ornitho.consumer_secret=os.environ.get("ORNITHO_CONSUMER_SECRET")ornitho.user_email=os.environ.get("ORNITHO_USER_EMAIL")ornitho.user_pw=os.environ.get("ORNITHO_USER_PW")ornitho.api_base="https://www.ornitho.de/api/"resp=ornitho.Observation.search_all(period_choice="range",date_from="01.10.2019",date_to="31.10.2019")print(f"Found{len(resp)}observations between 01.10.2019 and 31.10.2019")More examples can be found theexamplesfolder.PrerequisitesThe project has been tested with the following python versions:Python 3.7Python 3.8Python 3.9Python 3.10CollaborateAny kind of help with the project will be well received, and there are
two main ways to give such help:Reporting errors and asking for extensions through the issues managementor forking the repository and extending the projectIssues managementIssues are managed at the Githubproject issues
tracker, where
any Github user may report bugs or ask for new features.TestingThe tests included with the project can be run with:$ pytestor with a coverage report:$ pytest--cov=ornithotests/To test all supported Python versions, use tox:$ toxLicenseThe project has been released under theMIT
License.