cirro_api_client


Namecirro_api_client JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/CirroBio/Cirro-client-python
SummaryA client library for accessing Cirro
upload_time2024-12-13 22:31:40
maintainerNone
docs_urlNone
authorCirro
requires_python<4.0,>=3.8
licenseMIT
keywords cirro
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Cirro API Client
[![](https://img.shields.io/pypi/v/cirro-api-client.svg)](https://pypi.org/project/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 import CirroApiClient, TokenAuth
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 auth method, you can also extend the AuthMethod class
auth_method = TokenAuth(token=os.environ['TOKEN'])
# You can also use the RefreshableTokenAuth class
# auth_method = RefreshableTokenAuth(token_getter=lambda : os.environ['TOKEN'])

# Create a client
client = CirroApiClient(base_url="https://api.cirro.bio",
                        auth_method=auth_method)

# 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 import CirroApiClient, TokenAuth
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",
                        auth_method=TokenAuth(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 import CirroApiClient, TokenAuth

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",
    auth_method=TokenAuth(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 import CirroApiClient, TokenAuth

client = CirroApiClient(base_url="https://api.cirro.bio",
                        auth_method=TokenAuth(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 update --url https://dev.cirro.bio/openapi/cirro-data-latest.yml --config config.yml --custom-template-path=templates/
 ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/CirroBio/Cirro-client-python",
    "name": "cirro_api_client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "Cirro",
    "author": "Cirro",
    "author_email": "support@cirro.bio",
    "download_url": "https://files.pythonhosted.org/packages/10/41/04ccc033fd51334916ca0c593f0880dc46bdfc83d8e6678c4ccab6e2c252/cirro_api_client-0.2.3.tar.gz",
    "platform": null,
    "description": "# Cirro API Client\n[![](https://img.shields.io/pypi/v/cirro-api-client.svg)](https://pypi.org/project/cirro_api_client/)\n\nLow-level client for the Cirro API. Rather than using this package directly, we recommend using the [Cirro SDK](https://github.com/CirroBio/Cirro-client).\n\nThis Python package is automatically generated by the [OpenAPI Python Client](https://github.com/openapi-generators/openapi-python-client) project.\n\n## Requirements.\n\nPython 3.8+.\n\n## Installation & Usage\n### pip install\n\nVia PyPI:\n```sh\npip install cirro-api-client\n```\n\nYou can also install it directory from the repository using:\n\n```sh\npip install git+https://github.com/CirroBio/Cirro-client-python.git\n```\n\n## Getting Started\n\n### Basic usage\n\n```python\nimport os\nfrom typing import List\nfrom pprint import pprint\n\nfrom cirro_api_client import CirroApiClient, TokenAuth\nfrom cirro_api_client.v1.api.projects import get_projects\nfrom cirro_api_client.v1.models import Project\nfrom cirro_api_client.v1.types import Response\n\n# Create auth method, you can also extend the AuthMethod class\nauth_method = TokenAuth(token=os.environ['TOKEN'])\n# You can also use the RefreshableTokenAuth class\n# auth_method = RefreshableTokenAuth(token_getter=lambda : os.environ['TOKEN'])\n\n# Create a client\nclient = CirroApiClient(base_url=\"https://api.cirro.bio\",\n                        auth_method=auth_method)\n\n# Call API endpoint, get list of projects\nprojects: List[Project] = get_projects.sync(client=client)\nprint(\"The response of get_projects:\\n\")\npprint(projects)\n## or if you need more info (e.g. status_code)\nresp: Response[List[Project]] = get_projects.sync_detailed(client=client)\nprojects = resp.parsed\n```\n\n### Async usage\n```python\nimport os\nfrom typing import List\n\nfrom cirro_api_client import CirroApiClient, TokenAuth\nfrom cirro_api_client.v1.api.projects import get_projects\nfrom cirro_api_client.v1.models import Project\n\nclient = CirroApiClient(base_url=\"https://api.cirro.bio\",\n                        auth_method=TokenAuth(token=os.environ['TOKEN']))\n\n# async method\nasync with client as client:\n    projects: List[Project] = await get_projects.asyncio(client=client)\n```\n\n### Advanced usage\n\nThere 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):\n\n```python\nimport os\nfrom cirro_api_client import CirroApiClient, TokenAuth\n\ndef log_request(request):\n    print(f\"Request event hook: {request.method} {request.url} - Waiting for response\")\n\ndef log_response(response):\n    request = response.request\n    print(f\"Response event hook: {request.method} {request.url} - Status {response.status_code}\")\n\nclient = CirroApiClient(\n    base_url=\"https://api.cirro.bio\",\n    auth_method=TokenAuth(token=os.environ['TOKEN']),\n    httpx_args={\"event_hooks\": {\"request\": [log_request], \"response\": [log_response]}},\n)\n\n# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()\n```\n\nYou can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):\n\n```python\nimport os\nimport httpx\nfrom cirro_api_client import CirroApiClient, TokenAuth\n\nclient = CirroApiClient(base_url=\"https://api.cirro.bio\",\n                        auth_method=TokenAuth(token=os.environ['TOKEN']))\n\n# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.\nclient.set_httpx_client(httpx.Client(base_url=\"https://api.cirro.bio\", proxies=\"http://localhost:8030\"))\n```\n\n## Developer information\n\nRe-generate the API client by running:\n\n```sh\nopenapi-python-client update --url https://dev.cirro.bio/openapi/cirro-data-latest.yml --config config.yml --custom-template-path=templates/\n ```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A client library for accessing Cirro",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://github.com/CirroBio/Cirro-client-python",
        "Repository": "https://github.com/CirroBio/Cirro-client-python"
    },
    "split_keywords": [
        "cirro"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0313c78f15b705467de5a222429d30ddbb8f1d2fd2eebb3ba2e55eedf4059d6b",
                "md5": "0199d22b9cab09dfbf883a41253c6894",
                "sha256": "1060a5a6a48cf1202a474b31f73eecfe221532dcdaa6b3d79fe96008f90d0790"
            },
            "downloads": -1,
            "filename": "cirro_api_client-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0199d22b9cab09dfbf883a41253c6894",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 226696,
            "upload_time": "2024-12-13T22:31:38",
            "upload_time_iso_8601": "2024-12-13T22:31:38.876296Z",
            "url": "https://files.pythonhosted.org/packages/03/13/c78f15b705467de5a222429d30ddbb8f1d2fd2eebb3ba2e55eedf4059d6b/cirro_api_client-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "104104ccc033fd51334916ca0c593f0880dc46bdfc83d8e6678c4ccab6e2c252",
                "md5": "04762c6f93539449c1cad4ea820873e2",
                "sha256": "d5ed5d2148e5dd43085799b5715d711289aa90ad848d89a23b075b9de6866835"
            },
            "downloads": -1,
            "filename": "cirro_api_client-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "04762c6f93539449c1cad4ea820873e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 67254,
            "upload_time": "2024-12-13T22:31:40",
            "upload_time_iso_8601": "2024-12-13T22:31:40.123568Z",
            "url": "https://files.pythonhosted.org/packages/10/41/04ccc033fd51334916ca0c593f0880dc46bdfc83d8e6678c4ccab6e2c252/cirro_api_client-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-13 22:31:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "CirroBio",
    "github_project": "Cirro-client-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cirro_api_client"
}
        
Elapsed time: 0.41364s