Skip to main content

mediate

Middleware for every occasion

Installation

mediate can be installed from PyPI

pip install mediate

Usage

@middleware

from mediate import middleware

def shout(call_next, name):
    return call_next(name.upper())

def exclaim(call_next, name):
    return call_next(name + "!")

@middleware(shout, exclaim)
def hello(name):
    print(f"Hello, {name}")
>>> hello("sam")
Hello, SAM!

Middleware

Middleware.bind

import mediate

middleware = mediate.Middleware()

@middleware
def shout(call_next, name):
    return call_next(name.upper())

@middleware
def exclaim(call_next, name):
    return call_next(name + "!")

@middleware.bind
def hello(name):
    print(f"Hello, {name}")
>>> hello("sam")
Hello, SAM!

Middleware.compose

import mediate

middleware = mediate.Middleware()

@middleware
def shout(call_next, name):
    return call_next(name.upper())

@middleware
def exclaim(call_next, name):
    return call_next(name + "!")

def hello(name):
    print(f"Hello, {name}")

composed_hello = middleware.compose(hello)
>>> hello("sam")
Hello, sam
>>> composed_hello("sam")
Hello, SAM!

Metadata

Release files for mediate 0.1.8

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

Source distribution (sdist)

Source distribution for mediate 0.1.8
File Size Uploaded Provenance Actions
mediate-0.1.8.tar.gz 3.5 kB Without provenance Details for mediate-0.1.8.tar.gz

Built distribution (wheel)

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

Total release size: 8.2 kB

Release files / mediate-0.1.8.tar.gz

Download URL mediate-0.1.8.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b92f618a89226281dea1e7115e5341fa3ecb9db6dd00772805fcb9d0ba214171
BLAKE2b-256 checksum
How to use checksums
3cda62b3cc202fad0be03380c852c207d9d6497778379341c224157abf0b3e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.10 Linux/5.4.0-144-generic

Release files / mediate-0.1.8-py3-none-any.whl

Download URL mediate-0.1.8-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9863947fc0e98774bf57b10b6218f482cad8f1abc84618d7ca9e9760fcd31fab
BLAKE2b-256 checksum
How to use checksums
0bed63f72682ab3b2db30d83b45eea470bb0a90e4b06dd5e943cd1ae50b7e2a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.8.10 Linux/5.4.0-144-generic

Security for mediate 0.1.8

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