-
Notifications
You must be signed in to change notification settings - Fork 87
PhantStream
PhantStream is a library for logging data to Spark Fun's Phant IoT server from the Beaglebone Black.
The server can be hosted on data.sparkfun.com or the Beaglebone Black.
Instructions for installing the Phant sever on the Beaglebone Black are available here.
The Phant server source code is available here.
This library allows you to publish data onto a stream, download the data in CSV of JSON formats and clear the data stream.
To download a data stream you will need its public key.
For data logging you will need the private key and the public key.
For clearing a stream you will need the private key.
All arguments must be sent as strings.
private_key is required for sending data to or clearing the server.
If data is being being hosted on data.sparkfun.com, the url field can be empty.
If data is being being hosted on the beaglebone, url must be mentioned.
#####send(samples)
Samples must be a dictionary.
Requires the private key.
Returns successful if log was successful else returns error message.
#####getJSON() Returns the logged data as a list of dictionaries i.e in .json format.
#####getCSV() Returns the logged data as a .csv.
#####getJSONinFile("file_name") Writes the logged data in .json to the file specified by file_name.
#####getCSVinFile("file_name") Writes the logged data in .csv to the file specified by file_name.
#####clear()
Clears the logged data in the stream.
Requires private key.
Returns the message from server.