March 02, 2015 | Python , Electronics |

A Python script to talk to the Spark Core

I have been playing around with the Spark Core and am very impressed with the built-in software support from Spark. This is a quick project that uses Python to talk to the Spark Core using the Spark cloud API. I also wanted the Spark Core to sent notifications to my program, and for this I am using Spark.publish() and Server Sent Events (SSE).

Here is a sample run of the program. (You can get the access token from Spark Build IDE.)

$ python --at XXXX_ACCESS_TOKEN --list
[{u'connected': True, u'last_heard': u'2015-02-26T02:17:22.450Z', u'last_app': None, u'id': u'xxxxxxx', u'name': u'yyyy'}]

$ python --at XXXX_ACCESS_TOKEN --listen
Notification: Yo 4 at 2015-02-26T01:59:02.272Z
Notification: Yo 5 at 2015-02-26T01:59:07.278Z
Notification: Yo 6 at 2015-02-26T01:59:12.281Z

You can find the source files for the project here, which has the Python code, as well as a simple Spark Core program for testing notifications. I look forward to playing with the Spark Photon next.


We love hearing from our readers. Email us at for questions or comments on this article. If you found this article useful, please support us by buying some of our Open Source hardware products - like ZeroDriver - an Arduino Zero compatible motor driver for robotics. ZeroDriver is crowdfunding right now. Please click here to support our campaign. and bring this product to market!

Please sign up for updates

Once in a while, we will send you an email update on the latest Electronut Labs projects and products. Your email address will never be shared or abused, ever.

2016 Electronut Labs. All rights reserved.