Metadata-Version: 2.4
Name: anilibria-api-client
Version: 0.2.3
Summary: Python async API wrapper for AniLibria Swagger
Author-email: semen-bol <syoma.bolotov@bk.ru>
License: MIT
Project-URL: Homepage, https://github.com/semen-bol/Anilibria-Api-Client
Project-URL: Docs, https://anilibria-api-client.readthedocs.io/stable/
Project-URL: Issues, https://github.com/semen-bol/Anilibria-Api-Client/issues
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp==3.12.15
Requires-Dist: aiofiles==24.1.0
Requires-Dist: pydantic==2.11.7
Requires-Dist: m3u8-To-MP4==0.1.11
Provides-Extra: docs
Requires-Dist: sphinx>=7.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=1.0.0; extra == "docs"
Requires-Dist: sphinx_design>=0.6.1; extra == "docs"
Requires-Dist: furo>=2025.7.19; extra == "docs"
Requires-Dist: sphinx-hoverxref>=1.3.0; extra == "docs"
Requires-Dist: readthedocs-sphinx-search>=0.1.2; extra == "docs"
Provides-Extra: dev
Requires-Dist: datamodel-code-generator<1.0.0,>=0.31.0; extra == "dev"
Requires-Dist: pytest<9.0.0,>=8.4.0; extra == "dev"
Dynamic: license-file

# Anilibria-Api-Client

[![pypi](https://img.shields.io/badge/anilibria_api_client_on_PyPi-blue)](https://pypi.org/project/anilibria-api-client)
![version](https://img.shields.io/badge/Version-0.2.3-blue)
![licence](https://img.shields.io/badge/License-MIT-green)
![python](https://img.shields.io/badge/Python-3.13%2B-blue)

> [!CAUTION]  
> **It is not an official wrapper.** [Official AniLibria's Swagger](https://anilibria.top/api/docs/v1)

Anilibria-API-Client - this a async client to work with Anilibria API, use a aiohttp. Full writed at python

## Installing

Developed and tested with Python 3.13. While it may work with other versions (oldest and newest), they are not officially supported.

### pip

```bash
$ pip install anilibria-api-client
```

## Usage

```python
from anilibria_api_client.api_client import AsyncAnilibriaAPI # Client
from anilibria_api_client.exceptions import AnilibriaException, AnilibriaValidationException # Errors
from anilibria_api_client.types import * # Types for some methods
from anilibria_api_client.models import * # Input models for some methods
from anilibria_api_client.responses import * # Response models generated from OpenAPI
from anilibria_api_client.helper import * # Download anime, save torrents files and more

async def main():
    async with AsyncAnilibriaAPI() as api:
        await api.teams.users(include="nickname")

    api = AsyncAnilibriaAPI() # like js support
    await api.teams.users(include="nickname")
```

## OpenAPI generation

AniLiberty schema source:

- docs: [https://anilibria.top/api/docs/v1#/](https://anilibria.top/api/docs/v1#/)
- schema: [https://anilibria.top/storage/api/docs/v1?aniliberty-api-v1-docs.json](https://anilibria.top/storage/api/docs/v1?aniliberty-api-v1-docs.json)

Generated artifacts are split from the hand-written client:

- `anilibria_api_client/types/schema/anilibria-v1.openapi.json` - locally cached OpenAPI schema
- `anilibria_api_client/types/codegen/openapi_models.py` - generated Pydantic v2 models and enums
- `anilibria_api_client/types/codegen/methods/` - generated low-level methods split by category
- `anilibria_api_client/types/models.py` - public input/request models
- `anilibria_api_client/types/responses.py` - public response models
- `anilibria_api_client/types/__init__.py` - public enums

Compatibility shims remain at:

- `anilibria_api_client/models.py`
- `anilibria_api_client/responses.py`
- `anilibria_api_client/response_models.py`

Do not edit these files manually:

- `anilibria_api_client/types/codegen/**`
- `anilibria_api_client/types/models.py`
- `anilibria_api_client/types/responses.py`
- `anilibria_api_client/types/__init__.py`

The async client now uses a two-layer method scheme:

- `anilibria_api_client/types/codegen/methods/*.py` - generated low-level endpoint methods grouped by category
- `anilibria_api_client/methods/*.py` - manual compatibility/override layer on top of generated methods

### Local update

Single command to refresh schema and generated files:

```bash
python scripts/update_openapi_models.py
```

Individual steps:

```bash
python scripts/fetch_openapi.py
python scripts/generate_models.py
```

### Drift check

To verify that schema-backed artifacts are up to date:

```bash
python scripts/check_schema_drift.py
```

The check regenerates the schema-backed files and fails if `git status` shows changes in:

- `anilibria_api_client/types/schema/anilibria-v1.openapi.json`
- `anilibria_api_client/types/codegen/`
- `anilibria_api_client/types/models.py`
- `anilibria_api_client/types/responses.py`
- `anilibria_api_client/types/__init__.py`
- `anilibria_api_client/models.py`
- `anilibria_api_client/responses.py`
- `anilibria_api_client/response_models.py`

### CI

The repository includes a dedicated workflow:

- on `pull_request` and `push` to `main`, it runs the drift check and smoke tests
- on weekly schedule and manual dispatch, it refreshes the schema and generated files, runs smoke tests, and opens a PR when a diff is detected

## Documentation 📃

[Docs](https://anilibria-api-client.readthedocs.io/stable/)

## Issues/Contributing

### Issues

Report for any issues [here](https://github.com/semen-bol/Anilibria-Api-Client/issues)

### Contributing

We allow contributing! Read the [CODE_OF_CONDUCT.md](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/CODE_OF_CONDUCT.md)

## License 📄

Anilibria-Api-Client is [MIT](https://github.com/semen-bol/Anilibria-Api-Client/blob/main/LICENSE) licenced.
