Skip to main content

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


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.3.3.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

Xevel-0.3.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file Xevel-0.3.3.tar.gz.

File metadata

  • Download URL: Xevel-0.3.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11

File hashes

Hashes for Xevel-0.3.3.tar.gz
Algorithm Hash digest
SHA256 bf2d27ea0e71eaf4584a26a587180576dac7a63149eb42db351c3440295e7433
MD5 3a90ea083478c6c64086ae2a39746b57
BLAKE2b-256 616e61888fd0b9a7c01c293c62a72f190889bdb9d87355e16c4bc7f608eec8ab

See more details on using hashes here.

File details

Details for the file Xevel-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: Xevel-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.7.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11

File hashes

Hashes for Xevel-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cf8cb4fd22357e2af291b95b2e661e5ec2b15e32ae5ff867f3beb3e6950eab27
MD5 0eb074744c19961057664595914d11b5
BLAKE2b-256 dd968f7b1ec72869565e6ffec0ff2c7e9bffed47d0eba2074106e00d3e65e0ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page