Python ASGI server
Project description
Xevel
My first attempt at a python ASGI server
Xevel is very much my first attempt at an ASGI server and it is definitely not perfect. I am open to any PRs or issues if you come across any problems.
NOTE: This will only work on UNIX-based systems.
A basic use example of Xevel could look like this:
from xevel import *
web = Xevel(('localhost', 9208)) # you can use tuples for port setups ('localhost', PORT') or unix sockets (provide file location as string)
# ('localhost', 9208) # inet
# '/tmp/test.sock' # unix
router = Router('localhost:9208') # force routers to only accept connections from certain domain/subdomains. can provide 1 as a string or multiple as a list
@router.before_request()
async def breq(req):
print('before request is running!!!')
@router.after_request()
async def areq(req):
print(f'after request is running!!! endpoint: {req.url}')
@router.route('/test')
async def test_route(req):
req.resp_headers['XD'] = 'lol'
return 'asgi server works no way!!!'
@web.before_serving()
async def before():
print('before serving is running!!!')
@web.after_serving()
async def after():
print('after serving is running!!!')
web.add_router(router)
web.start()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Xevel-0.1.6.tar.gz
(6.7 kB
view details)
Built Distribution
Xevel-0.1.6-py3-none-any.whl
(7.0 kB
view details)
File details
Details for the file Xevel-0.1.6.tar.gz
.
File metadata
- Download URL: Xevel-0.1.6.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e292e9a97a9115e8adb727ed3ae61c0a37e089933264d14d59a5a8c132770eec |
|
MD5 | 1de3746ef802a68b5e4b70144a9446b1 |
|
BLAKE2b-256 | 3f62c98fca30e6d8812410c993b152172327648e912746ef8ce87cd6e936fabd |
File details
Details for the file Xevel-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: Xevel-0.1.6-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77fc93c7b9ea63183e7e0e92f7d46b4badf3806a7efdbf2a63c4eb8196862c08 |
|
MD5 | 5aace88435215c633c94b9d07c6361e5 |
|
BLAKE2b-256 | 623f3a30eb5c311403035e5f31ca8a075de700c9691fa3ae11d5cb2c1fe218fb |