Metadata-Version: 2.1
Name: movebank-client
Version: 1.1.0
Summary: An async client for Movebank's API
License: Apache-2.0
Author: Chris Doehring
Author-email: chrisdo@earthranger.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: asyncclick (>=8.1.7.2,<9.0.0.0)
Requires-Dist: backoff (>=2.2.1,<3.0.0)
Requires-Dist: dateparser (>=1.2.0,<2.0.0)
Requires-Dist: environs (>=9.5,<10.0)
Requires-Dist: httpx (>=0.24.0,<0.25.0)
Requires-Dist: respx (>=0.20.1,<0.21.0)
Description-Content-Type: text/markdown

# Movebank Client
## Introduction
The movebank-client is an unofficial async python client to interact with Movebank's API, developed by the Gundi team of [EarthRanger](https://www.earthranger.com/),.

## Installation

```bash
pip install movebank-client
```

## Usage
```
from movebank_client import MovebankClient

# You can use it as an async context-managed client
async with MovebankClient(
    base_url="https://www.movebank.mpg.de",
    username="your-user",  
    password="your-password",
) as client:
    # Upload permissions for a study
    async with aiofiles.open("permissions.csv", mode='rb') as perm_file:
        await client.post_permissions(
            study_name="your-study",
            csv_file=perm_file
        )

    # Send tag data to a feed
    async with aiofiles.open("data.json", mode='rb') as tag_data:
        await client.post_tag_data(
            feed_name="gundi/earthranger",
            tag_id="your-tag-id",
            json_file=tag_data
        )

# Or create an instance and close the client explicitly later
client = MovebankClient()
# Send tag data to a feed
async with aiofiles.open("data.json", mode='rb') as tag_data:
    await client.post_tag_data(
        feed_name="gundi/earthranger",
        tag_id="your-tag-id",
        json_file=tag_data
    )
...
await client.close()  # Close the session used to send requests
```

### Using the CLI suite

There are 3 commands to use directly, in order to test Movebank API
endpoints and credentials:
- `get-events-for-study`: Get Events for a Study
- `get-individual-events`: Get Events for an Individual
- `get-study`: Get a Study, with option to fetch its individuals

For running the CLI suite help, run:

```bash
python cli.py --help
```

For running specific command help, run:

```bash
python cli.py <COMMAND_NAME> --help
```
All responses will be printed in the terminal as JSON or list responses. 


