# 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](https://authentication.eniris.be/docs). It offers users an interface which is inspired by the popular [requests](https://requests.readthedocs.io/en/latest/) library.
## Installation
To install the latest stable version, use:
```sh
pip install eniris
```
## Quick Example
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/eniris-international/eniris-api-python-driver",
"name": "eniris",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "eniris, api, rest",
"author": "Enris BV",
"author_email": "info@eniris.be",
"download_url": "https://files.pythonhosted.org/packages/ec/3e/80c9a21db5812f100c5456bd8ba47b282610690b9d0e2495f4727bf7266b/eniris-0.8.30.tar.gz",
"platform": null,
"description": "# Eniris API driver for Python\nThis 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](https://authentication.eniris.be/docs). It offers users an interface which is inspired by the popular [requests](https://requests.readthedocs.io/en/latest/) library.\n\n## Installation\nTo install the latest stable version, use:\n```sh\npip install eniris\n```\n## Quick Example\n```python\nfrom eniris import ApiDriver\n\ndriver = ApiDriver(\"myUsername\", \"myPassword\")\nhttp_response = driver.get(\"/v1/device\")\nresponse_body = http_response.json()\nprint(response_body['device'][:10])\ndriver.close()\n```\n## Details\nThe driver constructor accepts the following arguments:\n- username (string, required)\n- password (string, required)\n- authUrl (string, optional, default: 'https://authentication.eniris.be'): URL of authentication endpoint\n- apiUrl (string, optional, default: 'https://api.eniris.be'): URL of api endpoint\n- timeoutS (int, optional, default: 60): Request timeout in seconds\n- maximumRetries (int, optional, default: 5): How many times to try again in case of a failure due to connection or unavailability problems\n- initialRetryDelayS (int, optional, default: 1): The initial delay between successive retries in seconds.\n- maximumRetryDelayS (int, optional, default: 60): The maximum delay between successive retries in seconds.\n- session (requests.Session, optional, default: requests.Session()): A session object to use for all API calls.\n\nFurthermore, the following methods are exposed:\n- accesstoken: Get a currently valid accesstoken\n- get/delete: Send a HTTP GET/DELETE request. The following parameters are allowed:\n - path (string, required): Either a path relative to the apiUrl, or a full URL path\n - params (dict, optional, default: None): URL query parameters\n- post/put: Send a HTTP POST or PUT request. The following parameters are allowed:\n - path (string, required): Either a path relative to the apiUrl, or a full URL path\n - json (dict, optional, default: None): JSON body of the request. The json argument and the data argument cannot both be different from None\n - params (dict, optional, default: None): URL query parameters\n - data (string or dict, optional, default: None): Payload of the request. The json argument and the data argument cannot both be different from None\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Eniris API driver for Python",
"version": "0.8.30",
"project_urls": {
"Download": "https://github.com/eniris-international/eniris-api-python-driver/archive/refs/tags/v0.8.30.tar.gz",
"Homepage": "https://github.com/eniris-international/eniris-api-python-driver"
},
"split_keywords": [
"eniris",
" api",
" rest"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4c9c04c3009c3451b43431f1e3bfdccfa19998c7c4c5c3d61178e923ef4d8811",
"md5": "1807191bf97f6ad926a8184dbba7431e",
"sha256": "acfce5250326923bdc82ab9f709fcf56977769b93e2315a00c22503dec6248c3"
},
"downloads": -1,
"filename": "eniris-0.8.30-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1807191bf97f6ad926a8184dbba7431e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 40609,
"upload_time": "2024-10-31T09:12:05",
"upload_time_iso_8601": "2024-10-31T09:12:05.995955Z",
"url": "https://files.pythonhosted.org/packages/4c/9c/04c3009c3451b43431f1e3bfdccfa19998c7c4c5c3d61178e923ef4d8811/eniris-0.8.30-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ec3e80c9a21db5812f100c5456bd8ba47b282610690b9d0e2495f4727bf7266b",
"md5": "3855507c42dc0efa40444114427aa8f4",
"sha256": "98d5103328a61f19d900fa71e3100c2fa2748c60d4ddb4c21c2e0d4c3e7f08a1"
},
"downloads": -1,
"filename": "eniris-0.8.30.tar.gz",
"has_sig": false,
"md5_digest": "3855507c42dc0efa40444114427aa8f4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32853,
"upload_time": "2024-10-31T09:12:06",
"upload_time_iso_8601": "2024-10-31T09:12:06.940144Z",
"url": "https://files.pythonhosted.org/packages/ec/3e/80c9a21db5812f100c5456bd8ba47b282610690b9d0e2495f4727bf7266b/eniris-0.8.30.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 09:12:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eniris-international",
"github_project": "eniris-api-python-driver",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "eniris"
}