In order 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 which should point 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.
Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.
With virtualenv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.
Code samples and snippets live in the samples/clearblade folder.
Our client libraries are compatible with all current active and maintenance versions of Python.
Python >= 3.7
Python <= 3.6
If you are using an end-of-life version of Python, we recommend that you update as soon as possible to an actively supported version.
pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
- clone the github repository.
- and execute the setup.py file like , python setup.py install.
- mostly if you change you imports from from google.cloud to clearblade.cloud everything else should work.
- 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 unexpeced values, then the default types listed previously are used.
- To temporarily use the source code in this repo. instead of the installed PyPi (pip) module do the following:
- Clone this repo.
- Checkout 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". So for example:
import sys
sys.path.insert(0, "path/to/python-iot")
from clearblade.cloud import iot_v1