Python Streamer: Streamer Constructor Parameters

These parameters are used in the constructor streamer=Streamer() and are separated by commas:
streamer = Streamer(bucket_name="Some Bucket Name", bucket_key="Some_Bucket_Key", access_key="YourAccessKey")

  • access_key=("Your_Access_Key")
  • The access_key is required to send the data you are streaming to your specific Initial State account. The access_key is a long string of letters and numbers that you can generate or check on the Account Page.
  • bucket_name="Bucket_Name"
  • The bucket_name is the name that appears in the Bucket Shelf so that you can tell your buckets apart. It accepts spaces. If you do not specify the bucket_name, then it will appear blank in the Bucket Shelf.
  • bucket_key="Bucket_Key"
  • Buckets are either created or consumed based on the unique combination of an access_key and a bucket_key. If no bucket_key is provided, the module will create a uuid4 as the bucket_key. The bucket_key overrides the bucket_name, so if two scripts have the same bucket_key but different bucket_names, the script that was run first will determine the name of the bucket. Specifying bucket_key allows you to send data from multiple scripts or devices to the same dataset.
  • buffer_size=Number
  • You can override the default event buffer size (the count of events) by passing the optional buffer_size parameter into the Streamer constructor. The default is 10.The decision to override this value should be based on how many log statements you make in a loop before sleeping. You can typically play around with this number help tune performance of the Streamer. Additionally, a higher buffer_size may help if getting throttled by the api. reason to override the buffer_size would be to effectively have a dynamic buffer size by increasing the buffer to a large value and using the Streamer.flush() method at the end of each loop iteration.
  • epoch=Time
  • Currently, the timestamp is automatically associated with data by retrieving the most accurate timestamp possible from the device as soon as a log or log_object method is called. However, you can override this with the epoch parameter:
  • time = time.time()
    streamer.log("signal", 5, epoch=time)
  • You can see a full example here.
  • debug_level=1,2
  • If you're having issues with your data you might want to try running ISStreamer at a higher debug level. With a debug_level at or greater than 2 the streamer will throw exceptions on logging errors. Otherwise, it will assume logging errors are not fundamentally exceptional. It will also display more verbose logging information. If you want to simply see what's being logged in the console, construct the Streamer object with the debug_level equal to 1.
  • ini_file_location="Path"
  • You can specify the location of a relevant .ini file in the Streamer constructor with ini_file_location. If the .ini file is in the same directory as your script, the path can simply be "./isstreamer.ini". This is useful if you are running a script at boot.

Feedback and Knowledge Base