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.0.4.tar.gz (18.6 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.0.4-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ahttp_client-1.0.4.tar.gz
  • Upload date:
  • Size: 18.6 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.0.4.tar.gz
Algorithm Hash digest
SHA256 dfe59873b583484aead37f0b7466e7a02eec515e425e0ccf814a4e78a983e1d2
MD5 d9cb65bd2d257c1075ba6e6e2fa7535f
BLAKE2b-256 d686006b5e5392cee7c460675479e66791c0186715f4c8a972d67e175c5f98df

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ahttp_client-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 28.4 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.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c15d444114c584d47ad1695dbb225aced51df4fe531cfd5e458e0d28e9f5dcdb
MD5 ca21ebe315624a88b70bd57e21785571
BLAKE2b-256 99e51352bd5c42244111de505f45fad33003ab9d38fe5de4f8fd07fb9c8edace

See more details on using hashes here.

Provenance

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