spsearch
Python tools to get species data from various API, including IUCN Red List and Encyclopedia of Life.
What is spsearch?
This is a collection of CLI tools which enable you to use various API with ease.
Why spsearch?
-
Using asyncio.
Unfortunately, some of the APIs are far from fastest (e.g. IUCN Red List API), so asynchronous retrieval will help you getting various info at once. -
For easier search.
Some of the APIs accept the only one certain scientific name of the species to search. For example, when you search Asian small-clawed otter withAonyx cinereavia 'Individual species by name' method, Red List API returns no result, as it is only referable inAonyx cinereus.spsearch.RedListApiHandler.species_from_name()both acceptsAonyx cinereaandAonyx cinereus.
How to use
translator.ja2sci (translate Japanese name into scientific name)
from spsearch.translator import ja2sci
print(ja2sci.convert('ユーラシアカワウソ')) # Lutra lutra
Red List API
You have to generate your own token here.
from pprint import pprint
import asyncio
from spsearch.redlist import RedListApiHandler
handler = RedListApiHandler(token=YOUR_REDLIST_API_TOKEN)
async def main():
# Get the info of Eurasian otter (Lutra lutra)
otter = await handler.species_from_name('Lutra lutra')
print(otter) # [NT]Lutra lutra
# Print some information about this species
print(otter.category) # NT
print(otter.order) # MUSTELIDAE
print(otter.assessment_date) # 2014-06-20
# Get the list of the threats
threats = await otter.get_threats()
# Threats are returned in a container class with some convenient method
print(threats)
# -> CodeHierarchySeq([
# <Threat 1.1: Housing & urban areas>,
# <Threat 1.2: Commercial & industrial areas>,
# <Threat 1.3: Tourism & recreation areas>,
# <Threat 2.4: Marine & freshwater aquaculture>,
# <Threat 2.4.3: Scale Unknown/Unrecorded>,
# <Threat 4.1: Roads & railroads>,
# ...
# ])
print(threats[2][4])
# -> CodeHierarchySeq([
# <Threat 2.4: Marine & freshwater aquaculture>,
# <Threat 2.4.3: Scale Unknown/Unrecorded>
# ])
print(threats.codes()) # [1, 2, 4, 5, 6, 7, 9]
# Use .slice() to slice the container
print(threats.slice(0)) # 1.1: Housing & urban areas
# Print some data for each threats
print(threats.code) # 1.1
print(threats.title) # Housing & urban areas
# The same methods are available for the habitats, conservation measures
pprint(await otter.get_habitats())
pprint(await otter.get_conservation_measures())
# Print the list of the countries in which they live
pprint(await otter.get_country_occurrence())
asyncio.run(main())
EOL API
If you want to use the cypher API, you need a token. Follow the guide here to get yours. Classical API doesn't need it.
Not yet prepared
Metadata
Release files for spsearch 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spsearch-0.1.0.tar.gz | 3.2 kB | Without provenance | Details for spsearch-0.1.0.tar.gz |
Release files / spsearch-0.1.0.tar.gz
| Download URL | spsearch-0.1.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05d1d360db2ba9a904de42b6bbeaa4721b24bdfdb93eaf696b73b104ec8665b3
|
|
BLAKE2b-256 checksum How to use checksums |
dfd0f6b5199d2ed1b9b982f410a346a82e8b86c4c312811f3eacf8e7d73afd4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|
Security for spsearch 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.