Skip to main content

A Python client for the IUCN Red List API

Project description

redlistapi

IUCN Red List API python interface

Description

A python interface and library for the IUCN Red List API https://api.iucnredlist.org/

Installation

Non-spatial

pip install redlistapi

Spatial

The Python GDAL library requires system-level libraries. Install GDAL headers before using:

Ubuntu/Debian:

# first install the OS GDAL binaries
# then install the python GDAL version that matches your OS binaries
sudo apt install libgdal-dev
pip install gdal==`gdal-config --version`

macOS (Homebrew): **untested

brew install gdal

Windows: **untested

Use precompiled wheels from https://www.lfd.uci.edu/~gohlke/pythonlibs/

Then install the package with spatial dependencies:

pip install redlistapi[spatial]

Usage

To use this library you must first obtain a personal IUCN Red List API token.

The library has 3 main use approaches:

Direct API endpoints

For direct endpoints the return value is the raw API response to allow parsing pages.

Openapi endpoints fall in 3 categories.

File-like endpoints  
  Note there is no trailing "/".  
  e.g.: api/v4/information/api_version
 
Folder-like endpoints
    Note there is a trailing "/".
    e.g.: api/v4/taxa/kingdom/
 
Parametrized endpoints
    Note there can be several file-like endpoints.
    e.g.: api/v4/taxa/kingdom/{kingdom_name}

File-like endpoints

redlistapi.api.v4.information.api_version(token=token).json()
redlistapi.api.v4.information.red_list_version(token=token).json()

Folder-like and Parametrized endpoints split in list and by_ endpoints

redlistapi.api.v4.taxa.family.list(token=token).json()
redlistapi.api.v4.taxa.kingdom.list(token=token).json()
redlistapi.api.v4.taxa.kingdom.by_kingdom_name(token=token, kingdom_name='CHROMISTA', year_published='2023').json()

Simplified user-end interface

The simplified user-end interface simply eliminates the need to enter the token.
This is useful for interactive use.

interface = redlistapi.V4_Interface(token)  
interface.information.api_version().json()  
animalia = interface.taxa.kingdom.by_kingdom_name(kingdom_name='animalia')  
animalia

Assessment Class and Factory

The Assessment Factory is a class that returns Assessment Classes.

The Assessment Class exposes exposes all data available from a Red List Assessment.

assessment_factory = redlistapi.AssessmentFactory(token=token)  
  
upupa = assessment_factory.from_assessment_id(assessment_id=181836360)  
upupa = assessment_factory.from_scientific_name(genus_name='Upupa', species_name='epops')  
upupa = assessment_factory.from_taxid(taxid=22682655)  
  
help(upupa)  
upupa.assessment_as_pandas()

Support

Submit requests and bugs on the repository's git page (https://gitlab.com/daniele.baisero/redlistapi).
Or contact Daniele Baisero (daniele.baisero-at-gmail.com).

Contributing

Contribution and collaboration offers are always welcome!

Authors and acknowledgment

Daniele Baisero, 2025.

License

MIT license; read LICENSE file.

Project status

Ongoing development.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redlistapi-0.1.1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redlistapi-0.1.1-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file redlistapi-0.1.1.tar.gz.

File metadata

  • Download URL: redlistapi-0.1.1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for redlistapi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9042d5cd9c92c413cde447926e2a09c6ef107f7156fc2e4732d3007791ddd380
MD5 5050661299f3bcf579e54f1f28a285ab
BLAKE2b-256 c9f01356aadde95cb0a64b67d41ed0e2577695433aa7335f23d17d2095937d0c

See more details on using hashes here.

File details

Details for the file redlistapi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: redlistapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for redlistapi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b174ed2d6388ecdee03b336c40a5a004fc076e3f1104fec5abd2e7bfaa0c53fa
MD5 11b33c889f5856cc8ef1d853c3aca718
BLAKE2b-256 7625f2f4b75cf7a438b8d63c9bc9f74b4863e8cef4beaf9d00214fd33bb15332

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page