Package to interact with the Opinum API
Project description
This package simplifies the Opinum API calls.
No magic. You need to follow the Opinum Swagger Documentation for correct formatting of your requests
Be aware that this is a new package, certainly missing a lot of features. Feel free to contribute.
You first need to create an instance of the ApiConnector class with following parameters:
environment
a dictionary of environment variables
if
None
, ApiConnector uses your environment variables (os.environ)Mandatory environment variables are:
- OPINUM_USERNAME: the Datahub user.
TAKE CARE: if this user has access to multiple tenants and if you do not specify a tenant id, ApiConnector will use the last tenant used.- OPINUM_PASSWORD: the password for the user
- OPINUM_CLIENT_ID: the client id for accessing the API
- OPINUM_SECRET the corresponding secret
Optional environment variables are:
- OPINUM_API_URL: another API URL than the Europe SaaS one (https://api.opinum.com)
- OPINUM_AUTH_URL: another authentication URL than the Europe SaaS one (https://identity.opinum.com)
- DEFAULT_PUSH_URL: another push URL than the Europe SaaS one (https://push.opinum.com)
- OPINUM_SCOPE: the scope of you session (default: "opisense-api")
if you want to push data, the scope should be "opisense-api push-data"
account_id
one of the tenant ids available for the Datahub user (default:
None
)
retries_when_connection_failure
number of extra attempts when no 200 or 204 return code (default: 0, maximum: 5)
Once you have your ApiConnector instance, you may use the class methods
- get
- post
- put
- delete
All keyword arguments will be converted to path parameters in the API call with one important exception, the data keyword referring to the body of your call.
There are two other class methods for data pushing because we have another API for this
- push_data
- push_dataframe_data
There is a little bit of magic with the method multi_thread_request_on_path that splits a list of parameters Allowing to make parallel calls.
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
Built Distribution
File details
Details for the file opinum-api-connector-1.1.1.tar.gz
.
File metadata
- Download URL: opinum-api-connector-1.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59ad6659bb6359000408ab6e6a97b542039202cfa9fd414ffcade5426399f0b6 |
|
MD5 | 8b69dfd1a6643630a0831eb9b6ab5d8d |
|
BLAKE2b-256 | 2ba1f0004017508aa2ce58d89e0a2c6c17f5f4206a52f7796a65482b976f06b1 |
File details
Details for the file opinum_api_connector-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: opinum_api_connector-1.1.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 085009014921ca9ad74e4edfe2163a4a90eace4541853a03c85a2b406c100731 |
|
MD5 | 14671079dc72c63796297d284b94ff52 |
|
BLAKE2b-256 | 24c7526c13d738045788bcd2d9cec55fe358f1d8e2226bafee780405b1d5d493 |