Skip to main content

Eniris API driver for Python

Project description

Eniris API driver for Python

This repository contains the official Eniris API driver for Python. This driver takes care of authentication as well as request retries and timeouts, in accordance with the authentication API documentation. It offers users an interface which is inspired by the popular requests library.

Installation

To install the latest stable version, use:

pip install eniris

Quick Example

from eniris import ApiDriver

driver = ApiDriver("myUsername", "myPassword")
http_response = driver.get("/v1/device")
response_body = http_response.json()
print(response_body['device'][:10])
driver.close()

Details

The driver constructor accepts the following arguments:

  • username (string, required)
  • password (string, required)
  • authUrl (string, optional, default: 'https://authentication.eniris.be'): URL of authentication endpoint
  • apiUrl (string, optional, default: 'https://api.eniris.be'): URL of api endpoint
  • timeoutS (int, optional, default: 60): Request timeout in seconds
  • maximumRetries (int, optional, default: 5): How many times to try again in case of a failure due to connection or unavailability problems
  • initialRetryDelayS (int, optional, default: 1): The initial delay between successive retries in seconds.
  • maximumRetryDelayS (int, optional, default: 60): The maximum delay between successive retries in seconds.
  • session (requests.Session, optional, default: requests.Session()): A session object to use for all API calls.

Furthermore, the following methods are exposed:

  • accesstoken: Get a currently valid accesstoken
  • get/delete: Send a HTTP GET/DELETE request. The following parameters are allowed:
    • path (string, required): Either a path relative to the apiUrl, or a full URL path
    • params (dict, optional, default: None): URL query parameters
  • post/put: Send a HTTP POST or PUT request. The following parameters are allowed:
    • path (string, required): Either a path relative to the apiUrl, or a full URL path
    • json (dict, optional, default: None): JSON body of the request. The json argument and the data argument cannot both be different from None
    • params (dict, optional, default: None): URL query parameters
    • data (string or dict, optional, default: None): Payload of the request. The json argument and the data argument cannot both be different from None

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

eniris-0.7.7.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

eniris-0.7.7-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file eniris-0.7.7.tar.gz.

File metadata

  • Download URL: eniris-0.7.7.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for eniris-0.7.7.tar.gz
Algorithm Hash digest
SHA256 260398a8790cdd8961ec16b30b78d34560c7f5db1756664923b5c3cd93bc525f
MD5 1d7f696b3fcf198fe11582c30e85efde
BLAKE2b-256 defdd3713b62fb5dbe83c0487b56853498ae1a4e83eeb3bf24d8adb66351b5b0

See more details on using hashes here.

File details

Details for the file eniris-0.7.7-py3-none-any.whl.

File metadata

  • Download URL: eniris-0.7.7-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for eniris-0.7.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4759245e435bb58e95fdd0bbc342a9cdfac1e01942d613544c291d20c7ed83ff
MD5 8e9f1c76a31dd973f6e5b5f84bbde5ef
BLAKE2b-256 ab8aa834d574fc4cbce79af8ecbbdfb920a0bfe76c0f897cf082cfb0fd138dec

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