Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.25 KB

README.md

File metadata and controls

77 lines (55 loc) · 2.25 KB

Disruptive Technologies Python Integrations

build codecov

Documentation

Installation

The package can be installed through pip:

pip install --upgrade dtintegrations

or from source:

pip install .

Requirements

  • Python 3.8, 3.9, 3.10, 3.11

Usage

Currently, the main functionality of this package is validating requests forwarded by a Data Connector.

The following example shows this for a Google Cloud Function.

from dtintegrations import data_connector, provider


def endpoint(request):
    # Validate and decode the incoming request.
    payload = data_connector.HttpPush.from_provider(
        request=request,
        provider=provider.GCLOUD,
        secret='<SIGNATURE_SECRET>',
    )

    # Print the payload data.
    print(payload)

    # If all is well, return 200 response.
    return ('OK', 200)

Examples

A few examples has been provided, but must be run either on a serverless platform or locally with a combination or ngrok and the appropriate development framework.

Exceptions

If a method is unsuccessful or has been provided with invalid parameters, an exception is raised. A list of available exceptions are available in the API Reference.

Development

Set up the development virtualenv environment:

make

Run unit-tests against the currently active python version:

make test

Lint the package code using MyPy and flake8:

make lint

Build the package distribution:

make build