amgi-cloudevents
CloudEvents HTTP adapter for AMGI applications.
Installation
pip install "amgi-cloudevents[uvicorn]==0.51.0"
Receiving CloudEvents
from amgi_cloudevents import run
from asyncfast import AsyncFast
app = AsyncFast()
@app.channel("com.example.event")
async def handle_event(payload: bytes) -> None: ...
if __name__ == "__main__":
run(app, host="0.0.0.0", port=8000)
You can also run an app through the AsyncFast CLI entry point:
asyncfast run amgi-cloudevents-uvicorn main:app --host 0.0.0.0 --port 8000
If the app sends follow-up messages, provide an outbound CloudEvents endpoint:
asyncfast run amgi-cloudevents-uvicorn main:app \
--message-send-endpoint https://example.com/events \
--message-send-source /orders \
--message-send-content-mode binary
Server accepts binary or structured CloudEvents on POST /event by default.
CloudEvent attributes and extensions are exposed as AMGI headers. For example,
ce-id: event-1 becomes (b"id", b"event-1").
AMGI message.ack returns 204 No Content. AMGI message.nack returns 500
with the nack message as the response body. Invalid CloudEvents return 400.
Sending CloudEvents
from amgi_cloudevents import MessageSend
from amgi_cloudevents import Server
message_send = MessageSend(
"https://example.com/events",
source="/orders",
content_mode="binary",
)
server = Server(app, message_send=message_send)
MessageSend maps AMGI message.send events to CloudEvents:
event["address"]becomes the CloudEventtypeevent["payload"]becomes the CloudEvent dataevent["headers"]become CloudEvent attributes/extensionssourcedefaults to/amgi-cloudevents, unless the AMGI headers includesource
content_mode can be "structured" or "binary". Structured mode is the
default.
If Server receives an AMGI message.send event without a configured
message_send, it raises an error explaining that outbound sending must be
wired explicitly.
Metadata
Release files for amgi-cloudevents 0.51.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| amgi_cloudevents-0.51.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / amgi_cloudevents-0.51.0-py3-none-any.whl
| Download URL | amgi_cloudevents-0.51.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c12d8dc5cef26aa0535e850c5ad9c13f9bcbc2e65598c548b8bdffe30c1690df
|
|
BLAKE2b-256 checksum How to use checksums |
c12148e77d2d6afcef07906414ad584d0633e65536b6c47adada924f415c60c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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 amgi-cloudevents 0.51.0
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.