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.

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: Xevel-0.4.4.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for Xevel-0.4.4.tar.gz
Algorithm Hash digest
SHA256 c477d6998f4ae986a63badd0ca950dbf3cf4c1134aec74be1002f5b96299bd7f
MD5 358f2cc8ddb4ee839fb2ce83bf2ee78b
BLAKE2b-256 2238b8c58d060836e4431207cd863072092e94c7111a49241b1d0508ad15dc09

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: Xevel-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for Xevel-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ec78bf26636765f2b2987ffa5078c2ffd51fcb5156700cc6d59d380107c3367c
MD5 1a6b004e8e13629daa7279241f4ccc5c
BLAKE2b-256 8ba0118f98c4c75751e18974860a25a3456dd8c296d98a6c068d9677ab1fac6d

See more details on using hashes here.

Provenance

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