Skip to content

disruptive-technologies/python-integrations

Repository files navigation

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

About

A Python 3 package for Disruptive Technologies Integrations.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published