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.8.15.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

eniris-0.8.15-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eniris-0.8.15.tar.gz
  • Upload date:
  • Size: 26.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for eniris-0.8.15.tar.gz
Algorithm Hash digest
SHA256 a74b8358b8145182f9c5be6d653333cfa48dcb3ba7067b0037971ee3d89395e8
MD5 907c9ab965a221801489f1cf03ba982b
BLAKE2b-256 07ff5b914b534be08b79e9c8803b37eab51b57509be7d243df323abad70a2dea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eniris-0.8.15-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for eniris-0.8.15-py3-none-any.whl
Algorithm Hash digest
SHA256 3d1db9e5edee0edadcbe921d9c9ae391c7d19207eb004da014437f7c8f82483e
MD5 5cd99a588a1d309fbf8fcef9baf90c3e
BLAKE2b-256 fe630c728e869f6d4b2b78af5dfc11c644afe840e668993d74ccbdef5fb37546

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