Cloud IoT API client library
Project description
To use this library, you first need to go through the following steps:
Install pip package - `pip install clearblade-cloud-iot`
Set an environment variable CLEARBLADE_CONFIGURATION, pointing to your ClearBlade service account JSON file.
Optionally set an environment variable BINARYDATA_AND_TIME_GOOGLE_FORMAT to True. Look at Note about types of times and binaryData below for details.
Installation
Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. It addresses dependencies and versions and, indirectly, permissions.
With virtualenv, it’s possible to install this library without system install permissions and clashing with the installed system dependencies.
Code samples and snippets
Code samples and snippets live in the samples/clearblade folder.
Supported Python versions
Our client libraries are compatible with all current active and maintenance versions of Python.
Python >= 3.7
Unsupported Python versions
Python <= 3.6
If you are using an end-of-life version of Python, we recommend you update it to an actively supported version as soon as possible.
Mac/Linux
pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
Windows
pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
Next steps
Clone the GitHub repository.
Execute the setup.py file like Python setup.py install.
Everything else should work if you change your imports from google.cloud to clearblade.cloud.
Note about types of times and binaryData
By default, the following parameters are returned as the shown types:
All time parameters (e.g. cloudUpdateTime, deviceAckTime, updateTime): RFC3339 strings (e.g. “2023-01-12T23:38:07.732Z”)
CONFIG binaryData: base64-encoded string
STATE binaryData: NON-base64-encoded string
To return these parameters using the same types used by the Google IoTCore Python SDK, set environment variable BINARYDATA_AND_TIME_GOOGLE_FORMAT to True (case-insensitive string). This will ensure the following parameters are returned as the shown types:
All times: DatetimeWithNanoseconds (defined in the proto.datetime_helpers module)
All binaryData (CONFIG, STATE etc.): BYTE ARRAYS
If this environment variable is not set, or is set to any unexpected values, then the default types listed previously are used.
Note about performance:
By default, calls to some SDK functions cause a REST request to be sent to acquire the registry API keys found on the IoTCore UI Registry Details page. Those keys are cached for subsequent operations to improve performance. However, these caches do not persist if the application is stopped and restarted, as would be the case with typical serverless functions (e.g., Google Cloud Functions, AWS Lambda, etc.). To improve those functions’ performance, the REST call can be prevented by passing the API keys as environment variables:
REGISTRY_URL: string
REGISTRY_SYSKEY: string
REGISTRY_TOKEN: string
Note about running from the source instead of the PyPi (pip) module:
To temporarily use the source code in this repo instead of the installed PyPi (pip) module, do the following:
Clone this repo.
Check out the desired branch using git checkout <branch>.
In your code find where clearblade or clearblade.cloud is being imported.
Precede that line with import sys and sys.path.insert(0, <path_to_python-iot>). The path must end with python-iot. For example:
import sys
sys.path.insert(0, "path/to/python-iot")
from clearblade.cloud import iot_v1
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 clearblade-cloud-iot-2.0.5.tar.gz
.
File metadata
- Download URL: clearblade-cloud-iot-2.0.5.tar.gz
- Upload date:
- Size: 41.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94a0735d6376f19763a5b8e32fe74d4d49a082b98b6b1877dbc5673c32b87aeb |
|
MD5 | 0ae5f29cc35baa667ca19d3d1127d700 |
|
BLAKE2b-256 | 64f58540b0d8333810f5c0b9a868a6ae1e094d45ef49c4039f53ce9d8ace2ada |
File details
Details for the file clearblade_cloud_iot-2.0.5-py2.py3-none-any.whl
.
File metadata
- Download URL: clearblade_cloud_iot-2.0.5-py2.py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a893fcd820f912ea4dc26d9a7319983d5e5c28e1eb84e6bf99086744107d3cd9 |
|
MD5 | da0772ccfad7337298e96923390225c9 |
|
BLAKE2b-256 | 635bfd2321d655fe3ab550435bb76e30c64407187346ada62419ce924f10acca |