# async-cdek-api Library


An asynchronous Python client library for the CDEK API. This SDK provides easy integration with CDEK delivery services, supporting all major API endpoints with type-safe models and comprehensive error handling.
## Features
- **Fully Asynchronous**: Built with `aiohttp` for non-blocking operations
- **Type Safety**: Complete Pydantic models for all API requests and responses
- **Auto Authentication**: Automatic OAuth token management with caching
- **Comprehensive Coverage**: Support for all major CDEK API endpoints:
- Order management (create, track, update)
- Tariff calculation and comparison
- Location and delivery point lookup
- Courier services
- Label and document printing
- Webhook management
- **Error Handling**: Robust error handling with detailed logging
- **Easy Integration**: Simple, intuitive API design
## Requirements
- Python 3.9+
- aiohttp
- pydantic
- loguru
## Installation
```bash
pip install async-cdek-api
```
Or install from source:
```bash
git clone https://github.com/avoidedabsence/async-cdek-api.git
cd async-cdek-api
pip install -e .
```
## Quick Start
```python
import asyncio
from cdek import CDEKAPIClient
from cdek.models import OrderRequest, OrderPackage, OrderSender, OrderRecipient, Location, Money
from cdek.enums import TariffCode
async def main():
# Initialize the client with your credentials
client = CDEKAPIClient(
client_id="your_client_id",
client_secret="your_client_secret"
)
# Calculate delivery cost
from cdek.models import TariffRequest
tariff_request = TariffRequest(
type=1, # Online store
from_location=Location(code=270), # Moscow
to_location=Location(code=44), # Ekaterinburg
packages=[{
"weight": 1000, # 1kg
"length": 30,
"width": 20,
"height": 10
}]
)
tariff = await client.calculate_tariff(tariff_request)
print(f"Delivery cost: {tariff.delivery_sum} RUB")
# Create an order
order = OrderRequest(
type=1, # Online store
number="ORDER-001",
tariff_code=TariffCode.EXPRESS_DOOR_TO_DOOR,
sender=OrderSender(
name="John Doe",
phones=["+7123456789"]
),
recipient=OrderRecipient(
name="Jane Smith",
phones=["+7987654321"]
),
from_location=Location(code=270),
to_location=Location(code=44),
packages=[OrderPackage(
number="PKG-001",
weight=1000
)]
)
result = await client.create_order(order)
print(f"Order created: {result.entity.uuid}")
if __name__ == "__main__":
asyncio.run(main())
```
## License
This project is licensed under the GNU v3.0 License - see the [LICENSE](LICENSE) file for details.
## Links
- [CDEK API Documentation](https://api.cdek.ru/)
- [PyPI Package](https://pypi.org/project/async-cdek-api/)
## Support
If you encounter any issues or have questions:
1. Check the [Issues](https://github.com/avoidedabsence/async-cdek-api/issues) page
2. Create a new issue with detailed description
3. Include code examples and error messages
Raw data
{
"_id": null,
"home_page": null,
"name": "async-cdek-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "api, async, cdek, courier, delivery, logistics, russia, shipping",
"author": null,
"author_email": "\"Alexey P.\" <i@apechenin.ru>",
"download_url": "https://files.pythonhosted.org/packages/a3/a9/90a8af50014943d0f20303fb78a94d690372eb3585edd8c464f8aa4f65f7/async_cdek_api-0.1.1.tar.gz",
"platform": null,
"description": "# async-cdek-api Library\n\n\n\n\nAn asynchronous Python client library for the CDEK API. This SDK provides easy integration with CDEK delivery services, supporting all major API endpoints with type-safe models and comprehensive error handling.\n\n## Features\n\n- **Fully Asynchronous**: Built with `aiohttp` for non-blocking operations\n- **Type Safety**: Complete Pydantic models for all API requests and responses\n- **Auto Authentication**: Automatic OAuth token management with caching\n- **Comprehensive Coverage**: Support for all major CDEK API endpoints:\n - Order management (create, track, update)\n - Tariff calculation and comparison\n - Location and delivery point lookup\n - Courier services\n - Label and document printing\n - Webhook management\n- **Error Handling**: Robust error handling with detailed logging\n- **Easy Integration**: Simple, intuitive API design\n\n## Requirements\n\n- Python 3.9+\n- aiohttp\n- pydantic\n- loguru\n\n## Installation\n\n```bash\npip install async-cdek-api\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/avoidedabsence/async-cdek-api.git\ncd async-cdek-api\npip install -e .\n```\n\n## Quick Start\n\n```python\nimport asyncio\nfrom cdek import CDEKAPIClient\nfrom cdek.models import OrderRequest, OrderPackage, OrderSender, OrderRecipient, Location, Money\nfrom cdek.enums import TariffCode\n\nasync def main():\n # Initialize the client with your credentials\n client = CDEKAPIClient(\n client_id=\"your_client_id\",\n client_secret=\"your_client_secret\"\n )\n \n # Calculate delivery cost\n from cdek.models import TariffRequest\n tariff_request = TariffRequest(\n type=1, # Online store\n from_location=Location(code=270), # Moscow\n to_location=Location(code=44), # Ekaterinburg\n packages=[{\n \"weight\": 1000, # 1kg\n \"length\": 30,\n \"width\": 20,\n \"height\": 10\n }]\n )\n \n tariff = await client.calculate_tariff(tariff_request)\n print(f\"Delivery cost: {tariff.delivery_sum} RUB\")\n \n # Create an order\n order = OrderRequest(\n type=1, # Online store\n number=\"ORDER-001\",\n tariff_code=TariffCode.EXPRESS_DOOR_TO_DOOR,\n sender=OrderSender(\n name=\"John Doe\",\n phones=[\"+7123456789\"]\n ),\n recipient=OrderRecipient(\n name=\"Jane Smith\",\n phones=[\"+7987654321\"]\n ),\n from_location=Location(code=270),\n to_location=Location(code=44),\n packages=[OrderPackage(\n number=\"PKG-001\",\n weight=1000\n )]\n )\n \n result = await client.create_order(order)\n print(f\"Order created: {result.entity.uuid}\")\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n## License\n\nThis project is licensed under the GNU v3.0 License - see the [LICENSE](LICENSE) file for details.\n\n## Links\n\n- [CDEK API Documentation](https://api.cdek.ru/)\n- [PyPI Package](https://pypi.org/project/async-cdek-api/)\n\n## Support\n\nIf you encounter any issues or have questions:\n\n1. Check the [Issues](https://github.com/avoidedabsence/async-cdek-api/issues) page\n2. Create a new issue with detailed description\n3. Include code examples and error messages\n",
"bugtrack_url": null,
"license": null,
"summary": "An asynchronous Python client library for the CDEK API",
"version": "0.1.1",
"project_urls": {
"Bug Tracker": "https://github.com/avoidedabsence/async-cdek-api/issues",
"Documentation": "https://github.com/avoidedabsence/async-cdek-api/blob/main/docs/API_REFERENCE.md",
"Homepage": "https://github.com/avoidedabsence/async-cdek-api",
"Repository": "https://github.com/avoidedabsence/async-cdek-api.git"
},
"split_keywords": [
"api",
" async",
" cdek",
" courier",
" delivery",
" logistics",
" russia",
" shipping"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4b75bc8e845b5de02467e186d501682f279d07b08d6efcae9835745aeec099f5",
"md5": "19d3d560a7efbe34f662ae2efdac193e",
"sha256": "2b2f8698cdb8b5a6b7f3d82a3134e5242e79f6fa8382dea4349c82f138dfbe27"
},
"downloads": -1,
"filename": "async_cdek_api-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "19d3d560a7efbe34f662ae2efdac193e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 55110,
"upload_time": "2025-08-03T22:47:45",
"upload_time_iso_8601": "2025-08-03T22:47:45.212157Z",
"url": "https://files.pythonhosted.org/packages/4b/75/bc8e845b5de02467e186d501682f279d07b08d6efcae9835745aeec099f5/async_cdek_api-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a3a990a8af50014943d0f20303fb78a94d690372eb3585edd8c464f8aa4f65f7",
"md5": "4e3b371ce000bffa46cdbd653e1e8e1e",
"sha256": "26b38595da989837185fa8948b27ffce37625804fda8cff5dee39f8abf5a06b7"
},
"downloads": -1,
"filename": "async_cdek_api-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "4e3b371ce000bffa46cdbd653e1e8e1e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 29597,
"upload_time": "2025-08-03T22:47:47",
"upload_time_iso_8601": "2025-08-03T22:47:47.155898Z",
"url": "https://files.pythonhosted.org/packages/a3/a9/90a8af50014943d0f20303fb78a94d690372eb3585edd8c464f8aa4f65f7/async_cdek_api-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-03 22:47:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "avoidedabsence",
"github_project": "async-cdek-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "async-cdek-api"
}