Metadata-Version: 2.1
Name: dtintegrations
Version: 0.6.1
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
Keywords: disruptive,technologies,dt,integration,api
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: disruptive >=1.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)

## Documentation

- [Python API Reference](https://developer.disruptive-technologies.com/api/libraries/python/)
- [Developer Documentation](https://developer.disruptive-technologies.com/docs/)

## Installation

The package can be installed through pip:

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

or from source:

```sh
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](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):
    # 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](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
```
