The package can be installed through pip:
pip install --upgrade dtintegrations
or from source:
pip install .
- Python 3.8, 3.9, 3.10, 3.11
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)
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.
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.
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