How to Stream Events in Python

Install The Python Module (github repo and detailed documentation)Choose one of the following methods:

Auto-install using cURL

\curl -sSL https://get.initialstate.com/python -o - | sudo bash

Manual install using pip

pip install ISStreamer
(if this fails due to a permissions error, you may need to add "sudo" to the beginning)

Start Streaming!
Review or copy the following example (if using the cURL setup, it can make a custom script just for you):
import time
from ISStreamer.Streamer import Streamer

streamer = Streamer(bucket_name="Stream Example", bucket_key="[Place A Unique Bucket Identifier Here]", access_key="[Place Your Access Key Here]")
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")

For more information, see the github repo and detailed documentation at https://github.com/InitialState/python_appender.

In this example, the events will show up in Initial State under the name "Stream Example".

Demo Video (2:00):


Feedback and Knowledge Base