Package: clearblade-cloud-iot
To use this library, you first need to go through the following steps:Install pip package -`pip installclearblade-cloud-iot`Set an environment variableCLEARBLADE_CONFIGURATION, pointing to your ClearBlade service account JSON file.Optionally set an environment variableBINARYDATA_AND_TIME_GOOGLE_FORMATto True. Look atNote about types of times and binaryDatabelow for details.InstallationInstall this library in avirtualenvusing pip.virtualenvis a tool to create isolated Python environments. It addresses dependencies and versions and, indirectly, permissions.Withvirtualenv, it’s possible to install this library without system install permissions and clashing with the installed system dependencies.Code samples and snippetsCode samples and snippets live in the samples/clearblade folder.Supported Python versionsOur client libraries are compatible with all currentactiveandmaintenanceversions of
Python.Python >= 3.7Unsupported Python versionsPython <= 3.6If you are using anend-of-lifeversion of Python, we recommend you update it to an actively supported version as soon as possible.Mac/Linuxpip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activateWindowspip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activateNext stepsClone 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 binaryDataBy default, the following parameters are returned as the shown types:All time parameters (e.g.cloudUpdateTime,deviceAckTime,updateTime):RFC3339strings (e.g. “2023-01-12T23:38:07.732Z”)CONFIG binaryData:base64-encoded stringSTATE binaryData:NON-base64-encoded stringTo return these parameters using the same types used by theGoogle IoTCore Python SDK, set environment variableBINARYDATA_AND_TIME_GOOGLE_FORMATtoTrue(case-insensitive string). This will ensure the following parameters are returned as the shown types:All times:DatetimeWithNanoseconds(defined in theproto.datetime_helpersmodule)AllbinaryData(CONFIG, STATE etc.):BYTE ARRAYSIf 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:stringREGISTRY_SYSKEY:stringREGISTRY_TOKEN:stringNote 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 usinggit checkout <branch>.In your code find whereclearbladeorclearblade.cloudis being imported.Precede that line withimport sysandsys.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