Skip to main content

Python module for Spark devices

Project description

Spyrk

Python module for Spark devices.

Use it as follow:

from spyrk import SparkCloud

USERNAME = 'he.ho@example.com'
PASSWORD = 'pasSs'
ACCESS_TOKEN = '12adza445452d4za524524524d5z2a4'

spark = SparkCloud(USERNAME, PASSWORD)
# Or
spark = SparkCloud(ACCESS_TOKEN)

# List devices
print spark.devices

# Access device
spark.devices['captain_hamster']
# Or, shortcut form
spark.captain_hamster

# List functions and variables of a device
print spark.captain_hamster.functions
print spark.captain_hamster.variables

# Tell if a device is connected
print spark.captain_hamster.connected

# Call a function
spark.captain_hamster.digitalwrite('D7', 'HIGH')
print spark.captain_hamster.analogread('A0')
# (or any of your own custom function)

# Get variable value
spark.captain_hamster.myvariable

Currently supporting:

  • Initialisation by username/password (generating a new access token every time).

  • Initialisation by access token (get it from the Build Web IDE).

  • Automatic discovery of devices.

  • Automatic discovery of functions and variables in a device.

  • Calling a function.

  • Accessing a variable value.

Not yet supported:

  • Subscribing and publishing events

  • Any PUT method of the API (like uploading a firmware or application.cpp). That would be cool though.

Installation

$ pip install spyrk

Licensing and contributions

Spyrk is licensed under LGPLv3 and welcome contributions following the C4.1 - Collective Code Construction Contract process.

Individual Contributors

A list of people who have contributed to Spyrk in order of their first contribution.

Format: Name-or-Well-known-alias <email@domain.tld> (url)

Please, add yourself when you contribute!

CHANGELOG

0.0.3 - ?

  • Fixed Python 3 support

0.0.2 - 30 July 2014

  • Complying to Flake8 code-style checker

  • Added accessing variable value

  • Added requires_deep_update to Device declaration

  • Fixed logging in bug and updated to support requires_deep_update value for the device

  • Added setup.py and refactored main package as Spyrk.SparkCloud

0.0.1 - 26 January 2014

  • Initial dump of code

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

spyrk-0.0.3.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spyrk-0.0.3-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file spyrk-0.0.3.tar.gz.

File metadata

  • Download URL: spyrk-0.0.3.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for spyrk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 20fb2c72cd3ad33004b945c4278a834520917d2d587db8e3e83835e7e7838e9f
MD5 423a081c43517e0148e1986c29acac8a
BLAKE2b-256 aaf820d8a2a303d4a58834cfb851871fba94c3dff123282e045dd57401fc0fce

See more details on using hashes here.

File details

Details for the file spyrk-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for spyrk-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 946f2c919489402726a01f7dfa42cf88d2815a459eabf6f3d84d4e45feead709
MD5 fea3010077d89c448b46f258bafe7707
BLAKE2b-256 55fd387375b91e55592abbd57e545e03b9061b7e8221ab4e6b2f69134b687e68

See more details on using hashes here.

Supported by

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