Skip to main content

Async Client Library

publish coverage codeql pypi license

🚀 Project Overview

async-client-lib is a sophisticated Python asynchronous HTTP client library designed to provide efficient, flexible, and robust HTTP request handling. Leveraging modern Python packaging tools and best practices, this library offers a comprehensive solution for building resilient network communication interfaces.

🛠 Technology Stack

Core Technologies

  • Language: Python 3.9+
  • Async Framework: aiohttp
  • Configuration Management: pydantic
  • Retry Mechanism: backoff

Development Tools

  • Package Management: Poetry
  • Testing: pytest, pytest-asyncio
  • Code Quality:
    • Formatting: Black
    • Linting: Ruff
    • Type Checking: mypy

📂 Project Structure

async-client-main/
├── async_client/
│   ├── __init__.py       # Core library initialization
│   ├── _client.py        # Base async HTTP client implementation
│   └── _exceptions.py    # Custom exception handling
├── pyproject.toml        # Project configuration and dependencies
├── README.md             # Project documentation
└── LICENSE               # MIT License

🔧 Key Components

1. BaseClient

  • Provides core async HTTP request management
  • Supports type-safe response parsing
  • Configurable client settings

2. ClientConfig

  • Manages client configuration parameters
  • Supports SSL verification, timeouts, and host configuration

3. Error Handling

  • Custom exception classes (BaseError, ClientError)
  • Comprehensive error logging and reporting

🚀 Quick Start

Installation

pip install async-client-lib
# Or using Poetry
poetry add async-client-lib

Usage Example

from typing import List, Dict
from pydantic import BaseModel

from async_client import BaseClient, ClientConfig


class SlideShow(BaseModel):
    title: str
    author: str
    date: str
    slides: List[Dict]


class SlideShowResponse(BaseModel):
    slideshow: SlideShow


class HttpBinClient(BaseClient):

    async def get_json(self) -> SlideShow:
        url = self.get_path("json")
        resp = await self._perform_request("GET", url)
        data = self.load_schema(resp.body, SlideShowResponse)
        return data.slideshow


async def main():
    config = ClientConfig(
        HOST="https://httpbin.org",
        SSL_VERIFY=True,
        CLIENT_TIMEOUT=30,
    )
    async with HttpBinClient(config) as client:
        slideshow = await client.get_json()
        print(slideshow)


if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

🛡 Development

Setup

# Install dependencies
poetry install
# Run tests
poetry run pytest
# Code quality checks
poetry run black .
poetry run ruff check .

📋 Configuration Options

Parameter Description Default
HOST Base URL for requests Required
SSL_VERIFY SSL certificate verification True
CLIENT_TIMEOUT Request timeout duration 30

📄 License

MIT License

📞 Contact

Aleksey Matyunin

🔖 Version

Current version: 0.1.8

Note: Always refer to the latest documentation and release notes for the most up-to-date information.

Metadata

Release files for async-client-lib 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for async-client-lib 0.1.9
File Size Uploaded
async_client_lib-0.1.9.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for async-client-lib 0.1.9
File Interpreter ABI Platform
async_client_lib-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / async_client_lib-0.1.9.tar.gz

Download URL async_client_lib-0.1.9.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e485557e7a3b4e7f653c9eb3732ce6b8f9f2f2125ede6e0e4ba1fe887b906e1c
BLAKE2b-256 checksum
How to use checksums
0c6265cc6efe2913a6dd34f316bdfaad271d5a074a5a79c54e72950f38b0c0d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.1 Linux/6.8.0-1021-azure

Release files / async_client_lib-0.1.9-py3-none-any.whl

Download URL async_client_lib-0.1.9-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b84f7b1fe70d8c2aba646cf6ba73ef4b34917390407a46e39fd12ece72e45255
BLAKE2b-256 checksum
How to use checksums
b76fc71c48d8cbe0b7b35d6d00246172daf5f5aa107c1befe9bedf3d80883cb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.12.1 Linux/6.8.0-1021-azure

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page