Metadata-Version: 2.1
Name: cirro_api_client
Version: 0.0.4
Summary: A client library for accessing Cirro
Home-page: https://github.com/CirroBio/Cirro-client-python
License: MIT
Keywords: Cirro
Author: Cirro
Author-email: support@cirro.bio
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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
Requires-Dist: attrs (>=21.3.0)
Requires-Dist: httpx (>=0.20.0,<0.27.0)
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Project-URL: Repository, https://github.com/CirroBio/Cirro-client-python
Description-Content-Type: text/markdown

# Cirro API Client

Low-level client for the Cirro API. Rather than using this package directly, we recommend using the [Cirro SDK](https://github.com/CirroBio/Cirro-client).

This Python package is automatically generated by the [OpenAPI Python Client](https://github.com/openapi-generators/openapi-python-client) project:

## Requirements.

Python 3.8+.

## Installation & Usage
### pip install

Via PyPI:
```sh
pip install cirro-api-client
```

You can also install it directory from the repository using:

```sh
pip install git+https://github.com/CirroBio/Cirro-client-python.git
```

## Getting Started

### Basic usage

```python
import os
from typing import List
from pprint import pprint

from cirro_api_client.v1 import CirroApiClient
from cirro_api_client.v1.api.projects import get_projects
from cirro_api_client.v1.models import Project
from cirro_api_client.v1.types import Response

# Create a client
client = CirroApiClient(base_url="https://api.cirro.bio",
                        token=os.environ['TOKEN'])

# Call API endpoint, get list of projects
projects: List[Project] = get_projects.sync(client=client)
print("The response of get_projects:\n")
pprint(projects)
## or if you need more info (e.g. status_code)
resp: Response[List[Project]] = get_projects.sync_detailed(client=client)
projects = resp.parsed
```

### Async usage
```python
import os
from typing import List

from cirro_api_client.v1 import CirroApiClient
from cirro_api_client.v1.api.projects import get_projects
from cirro_api_client.v1.models import Project

client = CirroApiClient(base_url="https://api.cirro.bio",
                        token=os.environ['TOKEN'])

# async method
async with client as client:
    projects: List[Project] = await get_projects.asyncio(client=client)
```

### Advanced usage

There are more settings on the generated `CirroApiClient` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):

```python
import os
from cirro_api_client.v1 import CirroApiClient

def log_request(request):
    print(f"Request event hook: {request.method} {request.url} - Waiting for response")

def log_response(response):
    request = response.request
    print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")

client = CirroApiClient(
    base_url="https://api.cirro.bio",
    token=os.environ['TOKEN'],
    httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
)

# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
```

You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):

```python
import os
import httpx
from cirro_api_client.v1 import CirroApiClient

client = CirroApiClient(base_url="https://api.cirro.bio",
                        token=os.environ['TOKEN'])

# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
client.set_httpx_client(httpx.Client(base_url="https://api.cirro.bio", proxies="http://localhost:8030"))
```

## Developer information

Re-generate the API client by running:

```sh
openapi-python-client.exe update --url https://api.cirro.bio/openapi/cirro-data-latest.yml --config config.yml --custom-template-path=templates/
 ```
