A framework for easy asynchronous HTTP request calling with decorations
Project description
ahttp-client
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ahttp_client-1.0.3.tar.gz.
File metadata
- Download URL: ahttp_client-1.0.3.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8544bb3cd957080c6ca586018b005510d35af99bef1bb816d795714369b9e32
|
|
| MD5 |
74bd3c58a41234f8b6f8a72b0fff0c11
|
|
| BLAKE2b-256 |
e67e40e20003cc04dc85a3810cdd53798042c3ae1d61ccce867605b35f1cf55c
|
File details
Details for the file ahttp_client-1.0.3-py3-none-any.whl.
File metadata
- Download URL: ahttp_client-1.0.3-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82a64a8e7f69801727f6dc095cb44ddd073f7132bd8dc1df4f184f5b6c1c2a30
|
|
| MD5 |
a54c3cf7c462daacaf0e82cfd76e4e18
|
|
| BLAKE2b-256 |
d0d9b0b804a5d81a22b0bc399f01f4159984a8c83a5d6aff6a728fa7889d55d7
|