Protocol library for OS2mo HTTP triggers
Project description
OS2mo HTTP Trigger Protocol
This package contains the interfaces used for the OS2mo http trigger protocol.
Usage
Install into your project using pip
:
pip install os2mo-http-trigger-protocol
Then import it inside a Python file:
from typing import List
from os2mo_http_trigger_protocol import (
EventType,
MOTriggerPayload,
MOTriggerRegister,
RequestType,
)
from fastapi import FastAPI
app = FastAPI()
@app.get(
"/triggers",
summary="List triggers to be registered.",
response_model=List[MOTriggerRegister],
)
def triggers():
"""List triggers to be registered."""
return [
{
"event_type": EventType.ON_BEFORE,
"request_type": RequestType.EDIT,
"role_type": "org_unit",
"url": "/triggers/ou/edit",
}
]
@app.post(
"/triggers/ou/edit",
summary="Print that an organizational unit has been edited",
)
async def triggers_ou_create(payload: MOTriggerPayload):
"""Fired when an OU has been created."""
return {"Hello": "World"}
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
Built Distribution
Close
Hashes for os2mo-http-trigger-protocol-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2230de18ff4fc24c94b1392a98a23a44414c624250ec7c838680afb018bc93f6 |
|
MD5 | 9a2a81086c8e10e7b31c9896d6f8c377 |
|
BLAKE2b-256 | 9ea437cab46fe70ac18c1e5b1f317cf5bf00b2f03eb62837b406cdbc48049709 |
Close
Hashes for os2mo_http_trigger_protocol-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 148fa874bace04d731a8f3f2ab316568866e2769fdaeae8301d23bb68bb1c08d |
|
MD5 | f200a89853c640daf2064da1768a8c6f |
|
BLAKE2b-256 | fc0cac5d020c257c50f87c1a911436c8bb62183faf0bf771c7856aa4a23e3ce9 |