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.4.2.tar.gz
(7.2 kB
view details)
Built Distribution
Xevel-0.4.2-py3-none-any.whl
(7.4 kB
view details)
File details
Details for the file Xevel-0.4.2.tar.gz
.
File metadata
- Download URL: Xevel-0.4.2.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a5646cdf599f53cb6932d3e0aeb6acda3d3e6b954f558363e9abe1774963a3e |
|
MD5 | b24acb5dcd0df444155366dc23139205 |
|
BLAKE2b-256 | 9a4a99fda8f1b7c2b9ff2f894d05b7defec5849d76997f8c06b26a8bef853e36 |
File details
Details for the file Xevel-0.4.2-py3-none-any.whl
.
File metadata
- Download URL: Xevel-0.4.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc83b927486a278ea3284edb23c0c22edd0b2156ddb73b5ad9412f276848f75c |
|
MD5 | 61891425922fcb0e88a5c75e59fbeb05 |
|
BLAKE2b-256 | 9bb47450eb40013a547f41ac76b8242844604bfa89d061fc63d0a65767cc44a6 |