Skip to main content

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

os2mo-http-trigger-protocol-0.0.4.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file os2mo-http-trigger-protocol-0.0.4.tar.gz.

File metadata

  • Download URL: os2mo-http-trigger-protocol-0.0.4.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for os2mo-http-trigger-protocol-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2230de18ff4fc24c94b1392a98a23a44414c624250ec7c838680afb018bc93f6
MD5 9a2a81086c8e10e7b31c9896d6f8c377
BLAKE2b-256 9ea437cab46fe70ac18c1e5b1f317cf5bf00b2f03eb62837b406cdbc48049709

See more details on using hashes here.

File details

Details for the file os2mo_http_trigger_protocol-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: os2mo_http_trigger_protocol-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

File hashes

Hashes for os2mo_http_trigger_protocol-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 148fa874bace04d731a8f3f2ab316568866e2769fdaeae8301d23bb68bb1c08d
MD5 f200a89853c640daf2064da1768a8c6f
BLAKE2b-256 fc0cac5d020c257c50f87c1a911436c8bb62183faf0bf771c7856aa4a23e3ce9

See more details on using hashes here.

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