Metadata-Version: 2.1
Name: ahttp_client
Version: 1.0.1
Summary: A framework for easy asynchronous HTTP request calling with decorations
Home-page: https://github.com/gunyu1019/ahttp-client
Author: gunyu1019
Author-email: gunyu1019@yhs.kr
License: MIT
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: Korean
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp ==3.9.3
Requires-Dist: aiosignal ==1.3.1
Requires-Dist: async-timeout ==4.0.3
Requires-Dist: attrs ==23.2.0
Requires-Dist: charset-normalizer ==3.3.2
Requires-Dist: frozenlist ==1.4.1
Requires-Dist: idna ==3.6
Requires-Dist: multidict ==6.0.5
Requires-Dist: yarl ==1.9.4
Provides-Extra: lint
Requires-Dist: pycodestyle ; extra == 'lint'
Requires-Dist: black ; extra == 'lint'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'

 # ahttp-client
 
![PyPI - Version](https://img.shields.io/pypi/v/ahttp-client?style=flat)
![PyPI - Downloads](https://img.shields.io/pypi/dm/ahttp-client?style=flat)
![PyPI - License](https://img.shields.io/pypi/l/ahttp-client?style=flat)

Using `@decorator` to easily request an HTTP Client<br/>
This framework based on [aiohttp](https://github.com/aio-libs/aiohttp)'s http client framework.<br/>

Use Annotated Type to describe the elements required in an HTTP request.


## Installation
**Python 3.10 or higher is required.**

```pip
pip install ahttp-client
```

## Quick Example

An example is the API provided by the [BUS API](https://github.com/gunyu1019/trafficAPI).

```python
import asyncio
import aiohttp
from ahttp_client import request, Session, Query
from typing import Annotated, Any

loop = asyncio.get_event_loop()


class MetroAPI(Session):
    def __init__(self, loop: asyncio.AbstractEventLoop):
        super().__init__("https://api.yhs.kr", loop=loop)

    @request("GET", "/metro/station")
    async def station_search_with_query(
            self,
            response: aiohttp.ClientResponse,
            name: Annotated[str, Query]
    ) -> dict[str, Any]:
        return await response.json()


async def main():
    async with MetroAPI(loop) as client:
        data = await client.station_search_with_query(name="metro-station-name")
        print(len(data))


loop.run_until_complete(main())
```
