No project description provided
Project description
Function framework for Python
This framework provides a mechanism to write Function-as-a-Service style code in Python for handling HTTP events, including CloudEvents delivered via HTTP.
This framework is primarily intended to work with Knative, but also works to provide a generic server for handling CloudEvents over HTTP (e.g. from Kubernetes or on a local machine).
The framework uses reflection to find a suitable function to wrap; it should not be necessary to import any of the following modules in your own code unless you want (e.g. for type definitions):
frameork(this module; on PyPi ashttp-containerize)flaskcloudevents
Instead, simply ensure that you have a single non-_ prefixed function which
uses some combination of the following:
- HTTP request arguments (named
req,request,body,headersor of theflask.Requesttype) - CloudEvent arguments (named
event,payload,data,attributesor of thecloudevents.sdk.event.v1.Eventtype)
Usage:
import logging
from typing import Any
counter = 0
def DoEvent(data: Any, attributes: dict, req: Any):
global counter
counter = counter + 1
logging.info(f"Got data: {data}")
logging.info(f"From {req.origin}, my {counter}th request!")
attributes["type"] = "com.example.reply"
attributes["datacontenttype"] = "text/plain"
return attributes, "It's a demo"
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file http-containerize-0.3.14.tar.gz.
File metadata
- Download URL: http-containerize-0.3.14.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
888d93f6c79856ac4b274cb56c06794aa404704c1b32b13bf1a800b5e15e4f4a
|
|
| MD5 |
2a681c04ba91c1806aba82f5b0c80b1f
|
|
| BLAKE2b-256 |
4a6ff0060423ab5cb394749afb3ffcdfc32639cf8f7f5aed5f049ab84c0bf06b
|
File details
Details for the file http_containerize-0.3.14-py3-none-any.whl.
File metadata
- Download URL: http_containerize-0.3.14-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c17d4ca105b8f4eafc14ea6bd3e3bdecdddcebed6913fe2e6ebc0fa59d09453a
|
|
| MD5 |
738baa126ee5c980f2d5b50f86ea2176
|
|
| BLAKE2b-256 |
204b31413a7433b40e42720e4dba2e5241b8e828030b68d3d061d582d360cdbf
|