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:
- 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
Release history Release notifications | RSS feed
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.5.0.tar.gz
(5.3 kB
view details)
Built Distribution
File details
Details for the file eniris-0.5.0.tar.gz
.
File metadata
- Download URL: eniris-0.5.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b32e06636f504ea3eac710a2131dc39e962d9fda0e51cde8a52ce12f98031c29 |
|
MD5 | 1910a45beb85af3b430f6f3311f1facd |
|
BLAKE2b-256 | ded66c5350328202ea33900f7bced974866e297d10e19a3275a77e90a0026f0a |
File details
Details for the file eniris-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: eniris-0.5.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15142fd1e9c761d4bdeba922cd627e286fc2ad0d8f58ce2fea3baa6d48d3add8 |
|
MD5 | c4944dcde6a06b59ddf96efcec12a151 |
|
BLAKE2b-256 | 2aa1bdb9b386e1148030462c7357766467ace132bdf0a35d90ba1e08dbd62df9 |