Skip to main content

This is a helper module to allow you to capture all the request/response which comes to your Flask app.

pip install flask-cdc-devlibx

How to use

from flask_cdc import cdc

# We expect you already have the flask app 
app = "Existing flask"


# Recorder is called everytime you get request response. You can do anything you want
# In this example we have logged data with a helper function provided by cdc. You can change
# this method to do anything else
def recorder(state):
    cdc.log_results(state)


# Wrap app to your session record MW    
app.wsgi_app = cdc.SessionRecorderMiddleware(app.wsgi_app, recorder)

How to enable CDC

Set following env variable:
export CDC_KAFKA=<your kafka broker>
export CDC_TOPIC=<your kafka topic for CDC>

You can use the pre-defined recorder to send data to kafka:

app.wsgi_app = cdc.SessionRecorderMiddleware(app.wsgi_app, cdc.publish_result_to_kafka)

Once it is defined then you can see the following data in your topic

{
  "request": {
    "body": {
      "archive_existing_versions": true,
      "name": "harish",
      "stage": "Staging",
      "version": "2"
    },
    "method": "POST",
    "url": "/ajax-api/2.0/preview/mlflow/model-versions/transition-stage"
  },
  "response": {
    "status": "200 OK"
  }
}

Metadata

Release files for flask-cdc-devlibx 0.0.11

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

Source distribution (sdist)

Source distribution for flask-cdc-devlibx 0.0.11
File Size Uploaded
flask-cdc-devlibx-0.0.11.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-cdc-devlibx 0.0.11
File Interpreter ABI Platform
flask_cdc_devlibx-0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / flask-cdc-devlibx-0.0.11.tar.gz

Download URL flask-cdc-devlibx-0.0.11.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6d28388e5187455496fecaa176782b601db81909b1212a7f64f2046f7114411a
BLAKE2b-256 checksum
How to use checksums
75975c656709808e64e22c3ec1b6056a3b8bc267ab23bb6327970893997a0480
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / flask_cdc_devlibx-0.0.11-py3-none-any.whl

Download URL flask_cdc_devlibx-0.0.11-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2ed71f9af277d6505b66ac44b6100e4a7045adfdd59bba05194d1bd9bf2a01b
BLAKE2b-256 checksum
How to use checksums
03d4a7d0bd227a927eece31ecc8a3f35104f540917fe3aaa94280b24169fd885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.11 This release

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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