Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

bazaar-contrib-http

Serve HTTP for the contribs of a composition from one listener. Contribs that accept HTTP register routes, mounted ASGI applications and middleware for as long as their lifespan runs.

bcn contrib add http --enable

The corresponding entry in config.toml:

version = "5"

[[contribs]]
package = "bazaar-contrib-http==0.3.*"
[[contribs.enabled]]
entry = "http"
[contribs.enabled.config]
listen = "127.0.0.1:8765"

listen takes host:port, [::1]:port, or either with a scheme in front; port 0 picks a free port.

A contrib registers what it serves inside its lifespan:

from contextlib import asynccontextmanager

from bazaar_contrib_http import HTTP
from bazaar_core import Context, Contrib
from starlette.responses import JSONResponse


async def status(request):
    return JSONResponse({"ok": True})


@asynccontextmanager
async def lifespan(ctx: Context):
    http = ctx.accept(HTTP)
    async with http.route("/status", status, methods=["GET"]):
        yield


reporter = Contrib(accepts=[HTTP], lifespan=lifespan)

http.mount(path, app) serves an ASGI application, such as a FastAPI app, under a path, and http.middleware(dispatch) wraps every request; the first middleware registered is the outermost. http.url is where the listener answers.

When a registration's context closes, it stops taking requests, and the requests it is still handling get five seconds to finish before they are cancelled. A request still running ten seconds after it is cancelled is no longer waited for.

Access log lines include each request's query string. An endpoint that receives secrets there, such as a sign-in callback, marks those parameters so that their values are logged as [redacted]:

from bazaar_contrib_http import redact


@redact("code", "state")
async def callback(request): ...

The mark works on endpoints registered with http.route and on the routes of a mounted Starlette or FastAPI application.

Metadata

Release files for bazaar-contrib-http 0.3.0rc1

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

Source distribution (sdist)

Source distribution for bazaar-contrib-http 0.3.0rc1
File Size Uploaded Provenance Actions
bazaar_contrib_http-0.3.0rc1.tar.gz 9.8 kB Without provenance Details for bazaar_contrib_http-0.3.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bazaar-contrib-http 0.3.0rc1
File Interpreter ABI Platform Actions
bazaar_contrib_http-0.3.0rc1-py3-none-any.whl Python 3 none any Details for bazaar_contrib_http-0.3.0rc1-py3-none-any.whl

Total release size: 20.5 kB

Release files / bazaar_contrib_http-0.3.0rc1.tar.gz

Download URL bazaar_contrib_http-0.3.0rc1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7dc1d1fa84df5c7adb5e42a1c55f44d7d1594077ea11669c33b60f2176d339c1
BLAKE2b-256 checksum
How to use checksums
b904f9ce2b545a098db45483edd625da935700a654a864163c1a136fd7fb744f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bazaar_contrib_http-0.3.0rc1-py3-none-any.whl

Download URL bazaar_contrib_http-0.3.0rc1-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17b091e01b5e1d33be189b49ff0e1af192969815d1eb10706d745b14c2a0d87f
BLAKE2b-256 checksum
How to use checksums
37c529f96fceedd5b758af9c6075e04287aaeb11f94275af40f029c02f4899a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bazaar-contrib-http 0.3.0rc1

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.

Release history Release notifications | RSS feed

This release
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