Push API resources Open API documentation
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.4.1
- Package version: 2.2.2
- Generator version: 7.6.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 3.7+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)
Then import the package:
import databox
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install to install the package for all users)
Then import the package:
import databox
Execute pytest to run the tests.
Please follow the installation procedure and then run the following:
# Configuration setup for the Databox API client # The API token is used as the username for authentication # It's recommended to store your API token securely, e.g., in an environment variable configuration = databox.Configuration( host = "https://push.databox.com", username = "<YOUR-CUSTOM-DATA-TOKEN>", password = "" ) # It's crucial to specify the correct Accept header for the API request with databox.ApiClient(configuration, "Accept", "application/vnd.databox.v2+json",) as api_client: api_instance = databox.DefaultApi(api_client) # Define the data to be pushed to the Databox Push API# Prepare the data you want to push to Databox # The 'key' should match a metric in your Databox account, 'value' is the data point, 'unit' is optional, and 'date' is the timestamp of the data point push_data = [{"key": "sales2", "value": 100, "unit": "USD", "date": "2021-01-01T00:00:00Z" }] try: api_instance.data_post(push_data=push_data) except ApiException as e: # Handle exceptions that occur during the API call, such as invalid data or authentication issues pprint("API Exception occurred: %s\n" % e) except Exception as e: # Handle any other unexpected exceptions pprint("An unexpected error occurred: %s\n" % e)