https://github.com/gunyu1019/ahttp-client
A framework provide concise and aintuitive asynchronous HTTP request using annotation types and @decorator.
https://github.com/gunyu1019/ahttp-client
aiohttp aiohttp-client http-client python
Last synced: 3 months ago
JSON representation
A framework provide concise and aintuitive asynchronous HTTP request using annotation types and @decorator.
- Host: GitHub
- URL: https://github.com/gunyu1019/ahttp-client
- Owner: gunyu1019
- License: mit
- Created: 2023-11-14T06:41:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-02T13:22:02.000Z (11 months ago)
- Last Synced: 2025-12-22T11:41:18.417Z (6 months ago)
- Topics: aiohttp, aiohttp-client, http-client, python
- Language: Python
- Homepage: https://gunyu1019.github.io/ahttp-client/en/
- Size: 210 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ahttp-client



An ahttp-client is Python package that provides concise and aintuitive asynchronous HTTP request using [annotated type](https://docs.python.org/ko/3.9/library/typing.html#typing.Annotated) 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.
```python
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.
```python
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
* English: https://gunyu1019.github.io/ahttp-client/en/
* Korean: https://gunyu1019.github.io/ahttp-client/ko/