Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ahttp-client

PyPI - Version PyPI - Downloads PyPI - License

An ahttp-client is Python package that provides concise and aintuitive asynchronous HTTP request using annotated type and @decorator.

Key Feautre

  • Defining a simple request method with decoration.
  • Managing HTTP Compoents using Annotated Types.
  • Providing Hooks before and after HTTP calls.

Getting Started

Implement a GithubService class extended with ahttp_client.AsyncSession. Then, create a list_repositories method using a request decorator.

An user argument define HTTP-component (Path) through annotation types.

import aiohttp
from typing import Annotated, Any

from ahttp_client import AsyncSession, Path, Response, request


class GithubService(AsyncSession):
    def __init__(self):
        super().__init__("https://api.github.com", aiohttp.ClientSession)

    @request("GET", "/users/{user}/repos")
    async def list_repositories(
        self, response: Response, user: Annotated[str, Path]
    ) -> list[dict[str, Any]]:
        return response.json()

Using the asynchronous context manager(async with), create a GithubService instance.

async with GithubService() as service:
    result = await service.list_repositories(user="gunyu1019")
    print(result)

Client Session in GithubServices are terminated when leave the asynchronous context manager.

Documentaion

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ahttp_client-2.0.0b1.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ahttp_client-2.0.0b1-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file ahttp_client-2.0.0b1.tar.gz.

File metadata

  • Download URL: ahttp_client-2.0.0b1.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for ahttp_client-2.0.0b1.tar.gz
Algorithm Hash digest
SHA256 55e15c3c3ad38ce6249191198a588d0611c23dab7c46db12a6132f55b74807e2
MD5 6fac14536397dfc979017b98c16b7c7b
BLAKE2b-256 475f83d63cfb68c3248fba82bba7163b40e9f76afc56d692e89bf033865342f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahttp_client-2.0.0b1.tar.gz:

Publisher: deploy.yml on gunyu1019/ahttp-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ahttp_client-2.0.0b1-py3-none-any.whl.

File metadata

  • Download URL: ahttp_client-2.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for ahttp_client-2.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 44da190b81ca527699b00923089b6e766aea694a044b5a5d0896bace9f2c9ff8
MD5 85fa5eec7897bb071b1c2fa00d4b3505
BLAKE2b-256 bfd0593abe0f29822696d710cb1d1119538ab2dde627d2539ce863f95705956d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahttp_client-2.0.0b1-py3-none-any.whl:

Publisher: deploy.yml on gunyu1019/ahttp-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.0.0

2 files

This release

2.0.0b1 This release

2 files

1.1.0

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 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