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

Uploaded Source

Built Distribution

Xevel-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Xevel-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 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

Hashes for Xevel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 89e2150209128065afc87d1289c1226780c41b8708b2d95bec6380b2fa4205b7
MD5 d9fde15852516d3ce3e7bdf557ec1d38
BLAKE2b-256 650d0d95d24d7ce9eaa53d635c9224f6db053a88975c57088c95119b6bb64e5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Xevel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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

Hashes for Xevel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ed17437f11bb49f6bc99a8cdf26c9b0ba494d7f94031f27856f0707d401b77e
MD5 190d9a36eaacd605ee39de378496ec9d
BLAKE2b-256 9ec8d06f00a762c63a9016e63f0ad82f9d92b4e01127d9b4c976961fe042344d

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