• Official comment
    Rachel Sanford

    Thank you for creating a Python Library for our API!

    We are actually in the process of creating a Python Library for the StreamLabs API, but it has not been published yet. Once we have published, we will let you know. In the meantime, thank you for sharing! 

  • Avatar

    Hi Chris,

    Thank you very much for your work on this (!)... I'm still climbing the learning curve on how to build around APIs, and your Python code has far and away been the most helpful thing I've stumbled upon.

    The Summary data I can pull with your code is working great for me.  I'm now trying to add to it so that I can also get hourly usage data for my monitor.  Here's the very simple code I've added:

    def get_hourly(self, location_id: str) -> dict:
      url = self.__STREAMLABS_API_URL + "/locations/" + location_id + "/readings/water-usage/?startTime=" + start_time
      headers = self.__get_base_headers()
      r=requests.get(url, headers=headers)
      return r.json()

    The Streamlabs API documents say you can also specify an end_time, a groupBy, and a page # to retrieve, but that all of these will have default values if not entered, so just giving start_time should be enough (I figured I could add the other strings to my url request once I figured "simplest case" out!).

    However so far, my request is getting:
    <Response [200]>

    I definitely know from my Streamlabs App and my Summary data returned from your code that I should be seeing a table populated with hourly information, so I'm not quite sure where I"m going wrong.  Could you or anyone else that might be working on this share their knowledge?

    Thank you,


  • Avatar

    Well that's peculiar... just tried the code again and it worked this time!  Maybe there's a bit of lag on the Streamlabs Cloud that was giving me the "None" error before... now I'm able to get the first 50 of my around 1243 hours of usage data.  

    In any case the hourly usage data might be a neat feature to have, especially in e.g. a Home Assistant-type dashboard panel.  I'm happy to share any code that I put together here or on github, but it's definitely not hard to figure out given the examples Chris provided.


Please sign in to leave a comment.