Skip to main content

A framework for easy asynchronous HTTP request calling with decorations

Project description

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.Session. Then, create a list_repositories method using a request decorator.

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

class GithubService(Session):
    def __init__(self):
        super().__init__("https://api.github.com")

    @request("GET", "/users/{user}/repos")
    def list_repositories(
        user: Annotated[str, Path]
    ) -> dict[str, Any]:
        return 

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

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

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

Documentaion

Project details


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-1.1.0.tar.gz (19.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-1.1.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file ahttp_client-1.1.0.tar.gz.

File metadata

  • Download URL: ahttp_client-1.1.0.tar.gz
  • Upload date:
  • Size: 19.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-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e6292ea1e9a10aac42f66ca07da415de7192843a26381bedb0bf895ff7b37849
MD5 ae9da007d18ac2135a855f200e58dcd2
BLAKE2b-256 fa79a175f2f879d2df5366d675ae15d7f1a1e3e85b54f5bf6a5b25ffc175ad3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahttp_client-1.1.0.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-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ahttp_client-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.9 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-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d240e5163341468996fc27563aab077570abca9611dc635a92c1ac3d826570c7
MD5 4a193fae12a30151fa450ab381492c07
BLAKE2b-256 37317374c87fdc3412dac57c6a69042dfb38442ac7ea7392196b4cc5de828e36

See more details on using hashes here.

Provenance

The following attestation bundles were made for ahttp_client-1.1.0-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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page