Skip to main content

iotery.io Python SDK

The python iotery.io SDK is intended to be used on your server or in your data processing apps to interact with the itoery.io IoT Platform. The SDK is a fully featured wrapper for the REST API.

Getting Started

Setup your free account on iotery.io and go to your settings dashboard to get your server API Key.

After you get your key, install the SDK:

pip install iotery-python-server-sdk

Note: Make sure you are using Python 3.5+!

And finally, some simple example usage:

from Iotery import Iotery


iotery = Iotery("my-key")

# find the exact `data` specification at https://iotery.io/v1/docs#createDeviceType
device_type = iotery.createDeviceType(
    data={"name": "My Device Type", "enum": "MY_DEVICE_TYPE", ...})

device_type_by_uuid = iotery.getDeviceTypeByUuid(
    deviceTypeUuid=device_type["uuid"], opts={"limit": 1})

The above code connects you to the iotary.io platform, creates a device type and then gets that device type.

Next, you might want to create a data type for the the device type you created...here's an example snippet:

temperature_data_type = iotery.createDataType(
  deviceTypeUuid=device_type_by_uuid["uuid"],
  data = {
    name: "Temperature",
    enum: "TEMPERATURE",
    units: "C",
    isNumber: true
  }
)

To have a "thing" (like a Raspberry Pi) create data, you will want to check out the iotery.io thing client.

For a tutorial on setting up a full stack system in 15 minutes using iotery.io, check out this link.

API

This SDK simply wraps the REST API, so more information and specifics can be found there. Since the API is a wrapper around the REST API, the syntax is standard for each of the Create, Read, Update, and Delete operations on iotery.io resources. All methods return a dictonary containing the API response. If there is an error, the method will raise an expection.

Creating Resources

The generalized syntax for creating resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", data={ "data": "variables" })

For example, to create a device, the javascript would look like

createDevice(
  deviceTypeUuid="a-valid-device-type-uuid",
  data={ "name": "My Device", "other": "parameter" }
)

where createDevice maps to methodName, deviceTypeUuid maps to inputParameter, and name and other map to the dictonary {data : "variables"} in the generalized form given above.

The available resource creation methods are

methodName input link description
getDeviceTokenBasic `` link Get token for device via key, serial, and secret.
reportAlreadyExecutedCommands `` link Report an already executed set of commands to the server.
createDeviceCommandInstanceEmbedded deviceUuid,commandTypeUuid link Create a command instance via a device.
postData deviceUuid link Post data to the cloud.
upsertDeviceSettings deviceUuid link Upsert settings for a device.
uploadDeviceLogs deviceUuid link Upload zip file of device logs.
getDeviceTokenAsymmetric `` link Get device token based on encrypted credentials.

Reading Resources

The generalized syntax for reading (getting) resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", opts={"query":"parameter"})

For example, to get a device by it's unique identifier uuid, the python would look like

getDeviceByUuid(
  deviceUuid="a-valid-device-uuid",
  opts={ "limit": 1 }
)

where getDeviceByUuid maps to methodName, deviceUuid maps to inputParameter, and { "limit": 1 } maps to the dictonary {"query" : "parameters"} in the generalized form given above.

The limit option is for instructive purposes only. By definition, a uuid is unique and so there will never be more than one device for a given uuid.

The available resource creation methods are

methodName input link description
getBrokerAddress `` link Get the MQTT broker address.
getCommandTypeListEmbedded `` link Get a list of available command types.
getCurrentTimestamp `` link Get the current server time in epoch (unix) time.
getDataTypeListEmbedded `` link Get a list of available data types.
getDeviceUnexecutedCommandInstanceList deviceUuid link Get a list of unexecuted command instances for a device.
getDeviceTypeFirmwareRecord deviceTypeUuid,version link Get a desired version of a firmware record for a given device type.
getPublicCloudKey `` link Get base64 encoded public key from the server for use in RSA scheme.
getMe `` link Get information about the device.
getNotificationListEmbedded `` link Get a list of available notifications.
getSettingTypeListEmbedded `` link Get a list of available setting types.

Updating Resources

The generalized syntax for updating resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", data={ "data": "variables" })

For example, to update a device type, the javascript would look like

updateDevice(
  deviceTypeUuid="a-valid-device-type-uuid",
  data={ "name": "My New Name" }
)

where updateDevice maps to methodName, deviceTypeUuid maps to inputParameter, and { "name": "My New Name" } maps to the dictonary {data : "variables"} in the generalized form given above.

The available resource creation methods are

methodName input link description
setBatchedCommandInstancesAsExecuted `` link Set a collection of batched command instances as executed.
setCommandInstanceAsExecuted `` link Report that a command has been executed to the server.
updateDeviceChannel `` link Update device channel.
setNotificationInstanceInactive `` link Set notification instance inactive.

Deleting Resources

The generalized syntax for reading (getting) resources in iotery.io python sdk looks like:

iotery.methodName(inputParameter="parameter", opts={"query":"parameter"})

For example, to get a device by it's unique identifier uuid, the python would look like

deleteDevice(
  deviceUuid="a-valid-device-uuid",
  opts={ "some": "option" }
)

where deleteDevice maps to methodName, deviceUuid maps to inputParameter, and { "some": "option" } maps to the dictonary {"query" : "parameters"} in the generalized form given above.

The available resource creation methods are

methodName input link description

Contributing

We welcome contributors and PRs! Let us know if you are interested.

Metadata

Release files for iotery-embedded-python-sdk 0.1.0

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

Source distribution (sdist)

Source distribution for iotery-embedded-python-sdk 0.1.0
File Size Uploaded Provenance Actions
iotery-embedded-python-sdk-0.1.0.tar.gz 7.5 kB Without provenance Details for iotery-embedded-python-sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iotery-embedded-python-sdk 0.1.0
File Interpreter ABI Platform Actions
iotery_embedded_python_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for iotery_embedded_python_sdk-0.1.0-py3-none-any.whl

Total release size: 19.1 kB

Release files / iotery-embedded-python-sdk-0.1.0.tar.gz

Download URL iotery-embedded-python-sdk-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6f0ac226c6ed44aa961bc0df2883ffa5a9c78678ee2e87250e387136619f03e7
BLAKE2b-256 checksum
How to use checksums
ae49e35821781a7d5582eca16ff2405f499ea469193448212b944e3a5364b560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release files / iotery_embedded_python_sdk-0.1.0-py3-none-any.whl

Download URL iotery_embedded_python_sdk-0.1.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1af403d6a93376f2585a91569989682ed483941c6cd322a5c180a46c1b028ad7
BLAKE2b-256 checksum
How to use checksums
e028d262989260f42b1cfc5de4492da4d2b5fd6f9d41b2d371d513984fedfd37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Security for iotery-embedded-python-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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