Skip to content

anitra-wildlife-tracking/anitra-api-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anitra logo

Anitra Anitra API documentation Anitra data model Python library


Sample implementation of the Anitra data API in Python.

Introduction

This code provides a reference implementation of an Anitra API-based application, a command line interface to export device list and device data. This code is only sample code to indicate how to work with the API, the code purposefully does not handle exceptions, does not check for inputs and contains some code duplication. If possible, it is preferrable to use the official API client library available on PyPi using pip install animaltrackingdata.

Usage

This project was developed and tested in Python 3.11.

Install the required libraries using requirements.txt.

pip install -r requirements.txt

To utilize the API, you will need to generate an API key in the Anitra platform. Further instructions are available on the user guide website.

Commands

Export device data

Exports all data you can access from the given device. This code uses the Anitra data scroll API endpoint to ensure data scroll consistency in case any new data is received.

Sample usage: python3 anitra-cli.py --clientid=YOUR_CLIENTID --clientkey=YOUR_CLIENT_KEY device-data 9999 --format csv --output 9999.csv

Export device list

Exports the list of devices your user account can access.

Sample usage: python3 anitra-cli.py --clientid=YOUR_CLIENTID --clientkey=YOUR_CLIENT_KEY device-data 9999 --format csv --output 9999.csv