Client for EarthRanger API
Project description
EarthRanger Client
Introduction
EarthRanger is a software solution that helps protected area managers, ecologists, and wildlife biologists make informed operational decisions for wildlife conservation.
The earthranger-client (er-client) is a Python library for accessing the EarthRanger HTTP API. It simplifies interaction with the API by abstracting away the complexity of resource-based endpoints and provides multi-threaded and async capabilities for improved performance.
Uses of er-client
- Extracting data for analysis
- Importing ecological or other historical data
- Integrating a new field sensor type. If you do and will be supporting multiple ER sites, contact us to talk about our Gundi integrations platform
- Performing external analysis that results in publishing an Alert on the ER platform.
Quick Start
see simple-example.py
Installation
From pypi
pip install earthranger-client
Usage
In your code, import the library and create an instance of the client.
from erclient import ERClient
client = ERClient(service_root="https://sandbox.pamdas.org/api/v1.0", username="", password="")
Async Support
We also offer an async client (asyncio).
Disclaimer: The async client current capabilities are limited to:
- Posting Sensor Observations (a.k.a Positions)
- Posting Events (a.k.a Reports)
- Posting Event Attachments
- Posting Camera Trap Reports
- Getting Event Types
- Getting Events
- Getting Observations
- Getting Subject Groups
- Getting Feature groups
- Getting Sources
- Getting Source Assignments (aka SubjectSource resources)
from erclient import AsyncERClient
# You can use it as an async context-managed client
async with AsyncERClient(service_root="https://sandbox.pamdas.org/api/v1.0", username="", password="") as client:
await self.er_client.post_sensor_observation(position)
await client.post_report(report)
await self.er_client.post_camera_trap_report(camera_trap_payload, file)
...
async with AsyncERClient(service_root="https://sandbox.pamdas.org/api/v1.0", username="", password="") as client:
async for observation in client.get_observations(start="2023-11-10T00:00:00-06:00"):
print(observation)
...
# Or create an instance and close the client explicitly later
client = AsyncERClient(service_root="https://sandbox.pamdas.org/api/v1.0", username="", password="")
await self.er_client.post_sensor_observation(position)
await client.post_report(report)
await self.er_client.post_camera_trap_report(camera_trap_payload, file)
...
await client.close() # Close the session used to send requests to ER API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file earthranger_client-1.10.0.tar.gz.
File metadata
- Download URL: earthranger_client-1.10.0.tar.gz
- Upload date:
- Size: 316.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e00744503f0db4cec6b131835b5b7d9dd98923c44df15435051a7eeb64b2a80e
|
|
| MD5 |
c23adcdd73c7010487c8ae543aaf9b3c
|
|
| BLAKE2b-256 |
c58c3fead1783fc9d047661feeade6f98ce1e59b0641dd738712dcb9a04ef4be
|
File details
Details for the file earthranger_client-1.10.0-py3-none-any.whl.
File metadata
- Download URL: earthranger_client-1.10.0-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56de4cbb0e6a39cb73d5e697c58218052bb5bdd864467bf672d48287e8e1fa23
|
|
| MD5 |
74e3fd11c035d466378df3b8dce954c7
|
|
| BLAKE2b-256 |
7f6162b8a5ec2008a420b2c16ed4ea92571a785281fa16303a60d53006599824
|