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.5.tar.gz (18.9 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.5-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ahttp_client-1.0.5.tar.gz
  • Upload date:
  • Size: 18.9 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.5.tar.gz
Algorithm Hash digest
SHA256 97bbd83e5669b0e5cb5eb4dc7a75819dd55e1b3843d3547763ba13dfef3ffacf
MD5 4e1f4c7da086b072122d0994bbb31269
BLAKE2b-256 ed7c2727a0969f2f97d65fd7924b9599af1dd606c2385928c35d130729d82059

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ahttp_client-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 28.7 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c72a8081f13c60134c91138551ff2c4b796ded5b9fa0be4a32ecf017d1c93957
MD5 04ca6ff819e0bca70fb21b33f2189b7b
BLAKE2b-256 b0a9d8679d18459a8044ce24876119963981e57c8c968bb4fcfa3373a4c3af89

See more details on using hashes here.

Provenance

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