Skip to main content

Notes

  1. This SDK is for use with ClearBlade IoT Core Standard and ClearBlade IoT Core Enterprise.

  2. ClearBlade IoT Core Enterprise is DIFFERENT from ClearBlade IoT Enterprise!!!

  3. If you are using ClearBlade but not using ClearBlade IoT Core (Standard or Enterprise), then you need this different SDK: https://github.com/ClearBlade/ClearBlade-Python-SDK.

  4. To understand how IoT Core Enterprise differs from Standard, look here: https://docs.clearblade.com/iotenterprise/iot-core.

To use this SDK, you first need to go through the following steps:

  1. Install pip package - `pip install clearblade-cloud-iot`

  2. Set an environment variable CLEARBLADE_CONFIGURATION, pointing to your ClearBlade service account JSON file (see below).

  3. Optionally set an environment variable BINARYDATA_AND_TIME_GOOGLE_FORMAT to True. Look at Note about types of times and binaryData below for details.

To create a service account and download a credentials JSON file look at the appropriate link below:

ClearBlade IoT Core Standard

ClearBlade IoT Core Enterprise

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:

  1. All time parameters (e.g. cloudUpdateTime, deviceAckTime, updateTime): RFC3339 strings (e.g. “2023-01-12T23:38:07.732Z”)

  2. CONFIG binaryData: base64-encoded string

  3. 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:

  1. All times: DatetimeWithNanoseconds (defined in the proto.datetime_helpers module)

  2. 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:

  1. REGISTRY_URL: string

  2. REGISTRY_SYSKEY: string

  3. 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:

  1. Clone this repo.

  2. Check out the desired branch using git checkout <branch>.

  3. In your code find where clearblade or clearblade.cloud is being imported.

  4. 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

Metadata

Release files for clearblade-cloud-iot 2.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clearblade-cloud-iot 2.0.7
File Size Uploaded
clearblade-cloud-iot-2.0.7.tar.gz 41.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clearblade-cloud-iot 2.0.7
File Interpreter ABI Platform
clearblade_cloud_iot-2.0.7-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 73.5 kB

Release files / clearblade-cloud-iot-2.0.7.tar.gz

Download URL clearblade-cloud-iot-2.0.7.tar.gz
Size 41.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5f107de1cfeba155c6a5869679bfadb805d5ce4c8d702e61edfe0a9cf49c5523
BLAKE2b-256 checksum
How to use checksums
cc9585b4948cc89b982f77844630f60bf9f2ad6fe9da63b7f5e75626aa5b03bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / clearblade_cloud_iot-2.0.7-py2.py3-none-any.whl

Download URL clearblade_cloud_iot-2.0.7-py2.py3-none-any.whl
Size 32.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ab6a6f6f5b781a37d983e4d8f39af2841bdf3dabefd1c768c637ab5102c3066e
BLAKE2b-256 checksum
How to use checksums
7566ab5445dc622be26fe1951d3925a525563a5f44282c677c8f1de6278e5686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

2.0.7 This release

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page