Metadata-Version: 2.1
Name: http-tools-abm
Version: 5.4.65001
Summary: 
Author: Mike Orlov
Author-email: m.orlov@technokert.ru
Requires-Python: >=3.11,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: aiohttp (>=3.9.3,<4.0.0)
Requires-Dist: async-tools-abm (>=2.1.57881,<3.0.0)
Requires-Dist: dynamic-types-abm (>=1.0.53968,<2.0.0)
Requires-Dist: init-helpers-abm (>=2.0.64464,<3.0.0)
Requires-Dist: multidict (>=6.0.4,<7.0.0)
Requires-Dist: yarl (>=1.9.3,<2.0.0)
Description-Content-Type: text/markdown

# Http tools

Async http server as component

Usage:

```python
import asyncio
import aiohttp

from http_tools import HttpServer, SerializableAnswer

async def amain():
    server: HttpServer = HttpServer(HttpServer.Config('localhost', port=8080))
    server.register_handler('/echo', lambda x: SerializableAnswer(x.key_value_arguments))
    session = aiohttp.ClientSession()
    try:
        await server._on_start()
        response = await session.get('http://localhost:8080/echo', params={'test': 'passed'})
        answer = await response.json()
        assert answer['result']['test'] == 'passed'

    finally:
        await session.close()
        await server._on_stop()

asyncio.run(amain())
```

