Skip to content

Instantly share code, notes, and snippets.

@elizabethn119
Created January 8, 2021 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elizabethn119/7814fed5547680a1b61cf4299dd38459 to your computer and use it in GitHub Desktop.
Save elizabethn119/7814fed5547680a1b61cf4299dd38459 to your computer and use it in GitHub Desktop.
#####
# This is a custom 'getting started' script, made with care for elizabeth@initialstate.com.
# If you have any questions, please email us! support@initialstate.com
#####
# Import the ISStreamer module
from ISStreamer.Streamer import Streamer
# Import time for delays
import time
# Streamer constructor, this will create a bucket called Python Stream Example
# you'll be able to see this name in your list of logs on initialstate.com
# your access_key is a secret and is specific to you, don't share it!
streamer = Streamer(bucket_name="Python Stream Example", bucket_key="python_example", access_key="XXXXXXXXX"
# example data logging
streamer.log("My Messages", "Stream Starting")
for num in range(1, 20):
time.sleep(0.1)
streamer.log("My Numbers", num)
if num%2 == 0:
streamer.log("My Booleans", False)
else:
streamer.log("My Booleans", True)
if num%3 == 0:
streamer.log("My Events", "pop")
if num%10 == 0:
streamer.log("My Messages", "Stream Half Done")
streamer.log("My Messages", "Stream Done")
## This is just an example, try something of your own!
## ideas:
## - solve world hunger, one bug fix at a time
## - create the worlds first widget
## - build an army of bug-free robot kittens
# Once you're finished, close the stream to properly dispose
streamer.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment