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

Uploaded Source

Built Distribution

Xevel-0.2.4-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Xevel-0.2.4.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for Xevel-0.2.4.tar.gz
Algorithm Hash digest
SHA256 ea85724fd5c667e1c567c566b03cf92f1f40dbec296d4b7f2d7cd52ea693ba9f
MD5 39cdf8689d856bda43ca4cbb37846184
BLAKE2b-256 9c9c8fe5735f8703a70488b7d566eb69a8bc8c4ed555893e8e7b80f6768cf5a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Xevel-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for Xevel-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6f3eab7fd23f7990496aed23fb28916ae4235aca3e8fd8ccd54da734fc744f73
MD5 4e7d4033c9347675df7e145b4a56e1d3
BLAKE2b-256 bf3fb035f3ec9014c0b9dc9cd6bc235ec20d0363e391a7bcdcd99d8aab06aac9

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