Metadata-Version: 2.1
Name: dtintegrations
Version: 0.5.0
Summary: Disruptive Technologies Python Integrations.
Home-page: https://github.com/disruptive-technologies/disruptive-dataconnector
Author: Disruptive Technologies Research AS
Author-email: developer-support@disruptive-technologies.com
License: UNKNOWN
Keywords: disruptive,technologies,dt,integration,api
Platform: UNKNOWN
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyjwt (<3.0.0,>=2.0.0)
Requires-Dist: disruptive (>=0.6.0)
Provides-Extra: dev
Requires-Dist: setuptools (>=54.2.0) ; extra == 'dev'
Requires-Dist: wheel (>=0.36.2) ; extra == 'dev'
Requires-Dist: pytest (>=6.2.2) ; extra == 'dev'
Requires-Dist: pytest-mock (>=3.5.1) ; extra == 'dev'
Requires-Dist: pytest-cov (>=2.11.1) ; extra == 'dev'
Requires-Dist: mypy (>=0.812) ; extra == 'dev'
Requires-Dist: flake8 (>=3.9.0) ; extra == 'dev'

# Disruptive Technologies Python Integrations

![build](https://github.com/disruptive-technologies/python-integrations/actions/workflows/build.yml/badge.svg)
[![codecov](https://codecov.io/gh/disruptive-technologies/python-integrations/branch/main/graph/badge.svg?token=KX0W7H6ALS)](https://codecov.io/gh/disruptive-technologies/python-integrations)

## Installation

The package can be installed through pip:

```sh
pip install --upgrade dtintegrations
```

or from source:

```sh
pip install .
```

### Requirements

- Python 3.7+

## Usage
Currently, the main functionality of this package is validating requests forwarded by a [Data Connector](https://developer.disruptive-technologies.com/docs/data-connectors/introduction-to-data-connector).  

The following example shows this for a [Google Cloud Function](https://cloud.google.com/functions).
```python
from dtintegrations import data_connector, provider


def endpoint(request):
    # Use the provider-specific validation function.
    payload = data_connector.http_push.decode_request(
        request=request,
        provider=provider.GCLOUD,
        secret='<DT_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](https://developer.disruptive-technologies.com/docs/data-connectors/development-guides/local-development-with-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](https://developer.disruptive-technologies.com/api/libraries/python/client/errors.html).

## 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
```


