Skip to main content

Python client library to connect to the VDX Core API

Project description

PyPI version Downloads

VDX Helper

This repository provides a wrapper for every call made to VDX Core Api.

How it works

This helper first needs to be authorized by wielding valid token from the authentication server, then use that token for further requests as long as it has not expired.

Each method also allows one to include their own custom mappers, enabling the method to return the result in the format the user wishes.

Prerequisites

  • Python Poetry
  • Docker + Docker-compose

Usage

Initialization

Required parameters:

  • api_url: The url leading to Core API server
  • auth_url: The url leading to authentication server
  • client_secret: The authentication secret
  • client_id: The ID of the client / partner
vdx_helper = VDXHelper(api_url='https://vizidox-core-api.com', auth_url='https://auth.com', client_secret=secret, client_id=client_id)

Mapper example

A mapper will receive a json-formatted parameter as their input. The following example mapper will add a field

def example_mapper(json_file):
    returned_json = copy.deepcopy(json_file)
    returned_json['additional_field'] = 'additional_value'
    return returned_json

Usage example

vdx_helper.upload_file(file=the_file_to_upload, mapper=example_mapper)

Running the tests

You can run the tests with poetry if you like. You can also obtain the code coverage.

poetry run pytest --cov=vdx_helper
  • Mypy:
poetry run mypy --config-file conf/mypy.ini vdx_helper
  • Coverage:
poetry run coverage run --source=vdx_helper -m pytest
poetry run coverage report
  • Tox:
tox -p

Run the test locally with docker-compose step-by-step

  1. Spin up the docker-containers
docker-compose up -d
  1. Run the tests via the vdx-helper docker container
docker-compose run vdx-helper pytest tests

Documentation

To build the documentation locally:

cd docs
make html

The build files can be found in docs/build. Open the generated index.html file in the html folder, and you can now navigate the documentation. Repeat the above command and refresh your browser every time you update the documentation. All source files are in docs/source, with vdx_helper containing the documentation generated from docstrings.

Authors

  • Tiago Santos - Initial work - Vizidox
  • Joana Teixeira - Corrections and improvements - Vizidox
  • Rita Mariquitos - Corrections and improvements - Vizidox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vdx_helper-3.2.4.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

vdx_helper-3.2.4-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file vdx_helper-3.2.4.tar.gz.

File metadata

  • Download URL: vdx_helper-3.2.4.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.7.7 Linux/5.15.0-1022-aws

File hashes

Hashes for vdx_helper-3.2.4.tar.gz
Algorithm Hash digest
SHA256 d66fc1f710cf99144a74c091d66fd31ab2e15664e0ab9f3e4cf60694c9f4c5cf
MD5 3b5a39b0b9da9f46b53aba8d881f5814
BLAKE2b-256 83dd6ef2bc42fde8611e91af81ad935f6ce2f2fb95443c0fbd05b18dd3e8fbc7

See more details on using hashes here.

File details

Details for the file vdx_helper-3.2.4-py3-none-any.whl.

File metadata

  • Download URL: vdx_helper-3.2.4-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.7.7 Linux/5.15.0-1022-aws

File hashes

Hashes for vdx_helper-3.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 12af3441a50bb6c0e825e75510dc2eebc0786a2aaa65253db33eacecd5bc5a08
MD5 249fd4fde5867bca2573f5d580deb8f6
BLAKE2b-256 9fbd58033c3af5cc1a4ad23b5acf564ecbf2c16e3c7f84ad33dd934817dccb51

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page