Skip to content

Latest commit

History

85 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

databox

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

Requirements.

Python 3.7+

Installation & Usage

pip install

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:

importdatabox

Setuptools

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:

importdatabox

Tests

Execute pytest to run the tests.

Basic example

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 variableconfiguration=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 requestwithdatabox.ApiClient(configuration, "Accept", "application/vnd.databox.v2+json",) asapi_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) exceptApiExceptionase:
# Handle exceptions that occur during the API call, such as invalid data or authentication issuespprint("API Exception occurred: %s\n"%e)
exceptExceptionase:
# Handle any other unexpected exceptionspprint("An unexpected error occurred: %s\n"%e)

About

Databox bindings for Python

Topics

Resources

Stars

6 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages