Skip to main content

Favicorn

CI PyPI version codecov Maintainability Test Coverage

Installation

pip3 install favicorn 

ASGI Usage

pip3 install httptools

main.py

import asyncio
import logging

from favicorn import ASGIFavicornBuilder


logging.basicConfig(
    level=logging.INFO, format="[%(asctime)s][%(levelname)s] %(message)s"
)
async def app(scope, receive, send) -> None:
    await send(
        {
            "type": "http.response.start",
            "status": 200,
            "headers": [(b"Content-Length", b"0")],
        }
    )
    await send({"type": "http.response.body", "body": b"", "more_body": False})
s = ASGIFavicornBuilder(
    app=app,
    http_parser_impl="httptools",
).build()

async def main() -> None:
    await s.init()
    try:
        await s.serve_forever()
    finally:
        await s.close()

asyncio.run(main())
python3 main.py
[2023-07-14 12:37:14,979][INFO] Socket ('127.0.0.1', 8000) acquired successfully using <class 'favicorn.socket_providers.inet.InetSocketProvider'>
[2023-07-14 12:37:14,979][INFO] Serve forever...

ASGI Usage with websockets

pip3 install httptools wsproto

main.py

import asyncio
import logging

from favicorn import ASGIFavicornBuilder


logging.basicConfig(
    level=logging.INFO, format="[%(asctime)s][%(levelname)s] %(message)s"
)

async def app(scope, receive, send) -> None:
    await send({"type": "websocket.accept"})
    msg = await receive()
    await send({"type": "websocket.send", "bytes": b"Something", "text": None})
    await send({"type": "websocket.close", "code": 1000})

s = ASGIFavicornBuilder(
    app=app,
    http_parser_impl="httptools",
    ws_impl='wsproto'
).build()

async def main() -> None:
    await s.init()
    try:
        await s.serve_forever()
    finally:
        await s.close()

asyncio.run(main())
python3 main.py
[2023-07-14 12:37:14,979][INFO] Socket ('127.0.0.1', 8000) acquired successfully using <class 'favicorn.socket_providers.inet.InetSocketProvider'>
[2023-07-14 12:37:14,979][INFO] Serve forever...

Metadata

Release files for favicorn 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for favicorn 0.0.5
File Size Uploaded Provenance Actions
favicorn-0.0.5.tar.gz 16.7 kB Without provenance Details for favicorn-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for favicorn 0.0.5
File Interpreter ABI Platform Actions
favicorn-0.0.5-py3-none-any.whl Python 3 none any Details for favicorn-0.0.5-py3-none-any.whl

Total release size: 45.9 kB

Release files / favicorn-0.0.5.tar.gz

Download URL favicorn-0.0.5.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
492438a0eaebe50953dcafde479812ceeb4093a621beb7e2e23af7f69378bd57
BLAKE2b-256 checksum
How to use checksums
9b70fcc3084d66aafef0f9c39843401a80a214073f1136a802073f3ae9a108b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / favicorn-0.0.5-py3-none-any.whl

Download URL favicorn-0.0.5-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b639ab068a93e5cd58d72b4f811ab682824a4449739aa7ce558b89e683fac97e
BLAKE2b-256 checksum
How to use checksums
a1ed261ce403304cf69088561d32f21fa5761159aba1ad10274e060b308c21fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Security for favicorn 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page