aiocdek


Nameaiocdek JSON
Version 0.1.7 PyPI version JSON
download
home_pageNone
SummaryAn asynchronous Python client library for the CDEK API
upload_time2025-08-17 17:41:43
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords api async cdek courier delivery logistics russia shipping
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aiocdek - comprehensive asynchronous library for interaction with CDEK API

![Python](https://img.shields.io/badge/python-3.9+-blue.svg)
![License](https://img.shields.io/badge/license-GNUv3.0-green.svg)

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 aiocdek
```

Or install from source:

```bash
git clone https://github.com/avoidedabsence/aiocdek.git
cd aiocdek
pip install -e .
```

## Quick Start

```python
import asyncio
from aiocdek import CDEKAPIClient
from aiocdek.models import OrderRequest, OrderPackage, OrderSender, OrderRecipient, Location, Money
from aiocdek.enums import TariffCode

async def main():
    # Initialize the client with your credentials
    client = CDEKAPIClient(
        client_id="your_client_id",
        client_secret="your_client_secret",
        test_environment=False, # If True, API URI = https://api.edu.cdek.ru/
        debug=False # If True, will log success/fail for each API request
    )
    
    # Calculate delivery cost
    from aiocdek.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/aiocdek/)

## Support

If you encounter any issues or have questions:

1. Check the [Issues](https://github.com/avoidedabsence/aiocdek/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": "aiocdek",
    "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/ae/e1/65bd1e7d1893cb6a8bca50ec5dc5f0a78002007b50939c2712ab581f1116/aiocdek-0.1.7.tar.gz",
    "platform": null,
    "description": "# aiocdek - comprehensive asynchronous library for interaction with CDEK API\n\n![Python](https://img.shields.io/badge/python-3.9+-blue.svg)\n![License](https://img.shields.io/badge/license-GNUv3.0-green.svg)\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 aiocdek\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/avoidedabsence/aiocdek.git\ncd aiocdek\npip install -e .\n```\n\n## Quick Start\n\n```python\nimport asyncio\nfrom aiocdek import CDEKAPIClient\nfrom aiocdek.models import OrderRequest, OrderPackage, OrderSender, OrderRecipient, Location, Money\nfrom aiocdek.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        test_environment=False, # If True, API URI = https://api.edu.cdek.ru/\n        debug=False # If True, will log success/fail for each API request\n    )\n    \n    # Calculate delivery cost\n    from aiocdek.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/aiocdek/)\n\n## Support\n\nIf you encounter any issues or have questions:\n\n1. Check the [Issues](https://github.com/avoidedabsence/aiocdek/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.7",
    "project_urls": {
        "Bug Tracker": "https://github.com/plassstic/aiocdek/issues",
        "Documentation": "https://github.com/plassstic/aiocdek/blob/main/docs/API_REFERENCE.md",
        "Homepage": "https://github.com/plassstic/aiocdek",
        "Repository": "https://github.com/plassstic/aiocdek.git"
    },
    "split_keywords": [
        "api",
        " async",
        " cdek",
        " courier",
        " delivery",
        " logistics",
        " russia",
        " shipping"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6c111e3b09282b5c7b220cfe3427a4fda6d236b31283fc6df7a04750e270457f",
                "md5": "d5c821a2b7315f6745bbf26bcc6af6b4",
                "sha256": "6a28146ff637122d06f9092a1d1003fd6e1fc2b245a4f820ed50292cd8e97ae6"
            },
            "downloads": -1,
            "filename": "aiocdek-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d5c821a2b7315f6745bbf26bcc6af6b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 32584,
            "upload_time": "2025-08-17T17:41:42",
            "upload_time_iso_8601": "2025-08-17T17:41:42.348195Z",
            "url": "https://files.pythonhosted.org/packages/6c/11/1e3b09282b5c7b220cfe3427a4fda6d236b31283fc6df7a04750e270457f/aiocdek-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "aee165bd1e7d1893cb6a8bca50ec5dc5f0a78002007b50939c2712ab581f1116",
                "md5": "82ec36f43dba38a6e291afdac15d6fbd",
                "sha256": "5e0e29a4d2d71d80d0c693fd069b95355ad8d7273eabc08a44c2674016bf464e"
            },
            "downloads": -1,
            "filename": "aiocdek-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "82ec36f43dba38a6e291afdac15d6fbd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 35636,
            "upload_time": "2025-08-17T17:41:43",
            "upload_time_iso_8601": "2025-08-17T17:41:43.985978Z",
            "url": "https://files.pythonhosted.org/packages/ae/e1/65bd1e7d1893cb6a8bca50ec5dc5f0a78002007b50939c2712ab581f1116/aiocdek-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-17 17:41:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "plassstic",
    "github_project": "aiocdek",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiocdek"
}
        
Elapsed time: 2.83355s