Skip to main content

iotery.io python server SDK

Project description

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-sdk

Note: Make sure you are using Python 3.5+!

And finally, some simple example usage:

from Iotery import Iotery


iotery = Iotery("my-key", base_url="http://localhost:3005")

# 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 this link out.

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

| createDeviceType | `` | link | Creates a new device type | | createDevice | deviceTypeUuid | link | Creates a new device with a given device type |

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

| getDeviceTypes | `` | link | Gets all device types | | getDeviceTypeByUuid | deviceTypeUuid | link | Gets a device type by uuid |

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

updateDeviceType(
  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

| updateDeviceType | deviceTypeUuid | link | Updates a device type by uuid |

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

| deleteDeviceType | deviceTypeUuid | link | Deletes a device type by uuid |

Contributing

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iotery-python-server-sdk-0.0.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

iotery_python_server_sdk-0.0.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file iotery-python-server-sdk-0.0.1.tar.gz.

File metadata

  • Download URL: iotery-python-server-sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for iotery-python-server-sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6629f3282c8bec52baf09ec4fd3031c216650dd1784c09e2a7d5456a00790a21
MD5 3602bef05068cca071791abc5438b9d2
BLAKE2b-256 08c8d96127ce498a1eea0efe33e7c113d4fa3a22458f80705cdef0e13e8a4bcc

See more details on using hashes here.

Provenance

File details

Details for the file iotery_python_server_sdk-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: iotery_python_server_sdk-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for iotery_python_server_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31692ef18fb1b8c02f297c70b89e6b439457d8001edbddbcdabcb9888d4f5e6f
MD5 559e112ed76bc70879750e2ed2debe44
BLAKE2b-256 9048fac09ec3dc01c602170131429a3c32f90fc913111dbf8d5886875f169b9f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page