# Simple ASGI HTTP 1.1 server implementation
This framework was inspired by [hypercorn](https://pgjones.gitlab.io/hypercorn/index.html) framework.
## How to install
```bash
pip install simple-asgi
```
## Example
```python
import os
import socket
from simple_asgi import app
from simple_asgi import response
from simple_asgi import router
async def hello(request):
request_body = await request.data
return response.Response(body=request_body)
sock_path = "/tmp/fn.sock"
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
os.remove(sock_path)
finally:
sock.bind("/tmp/fn.sock")
rtr = router.Router()
rtr.add("/call", ["POST"], hello)
http_app = app.SimpleASGI(name=__name__, router=rtr)
http_app.run(sock=sock)
```
This framework was inspired by [hypercorn](https://pgjones.gitlab.io/hypercorn/index.html) framework.
## How to install
```bash
pip install simple-asgi
```
## Example
```python
import os
import socket
from simple_asgi import app
from simple_asgi import response
from simple_asgi import router
async def hello(request):
request_body = await request.data
return response.Response(body=request_body)
sock_path = "/tmp/fn.sock"
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
os.remove(sock_path)
finally:
sock.bind("/tmp/fn.sock")
rtr = router.Router()
rtr.add("/call", ["POST"], hello)
http_app = app.SimpleASGI(name=__name__, router=rtr)
http_app.run(sock=sock)
```
Release files for simple-asgi 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_asgi-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / simple_asgi-0.0.2-py3-none-any.whl
| Download URL | simple_asgi-0.0.2-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdd5c69d11989bbec7e5ed91856637c69232e9bec690b8fe109aa576b88b4413
|
|
BLAKE2b-256 checksum How to use checksums |
ff9442efc3d41f26bdbfef3e0f2ca28915a1e90422747f756c578e99194b6fca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.1
|