Skip to main content

Python library for the StreamLabs Developer API

Project description

StreamLabs Python Library

This is the official python client for the StreamLabs Developer API.


See the StreamLabs Developer API docs

Use the package manager pip to install the package

pip3 install streamlabswater-streamlabswater


The package needs to configured with your accounts API Key available when you login into your account.

from streamlabswater import Stream


Get all Locations

Start by fetching all your locations

locations = stream.get_locations()

Get a Location

A location_id is required to fetch details of a location, water usage and for updating homeAway.

location_id = locations[0]['location_id']

my_home = stream.get_location(location_id)

Update a Location

Currently you can only update the homeAway mode of the location When updating a location the response is always the updated location details

# Set to home
my_home = stream.update_location(location_id, 'home')

# Set to away
my_home = stream.update_location(location_id, 'away')

Subscribe to Location Alerts

If you choose to recieve notifications when alerts become active or end for a location, you need to provide a valid url endpoint where the StreamLabs service will send the notifications. The following methods wrap the corresponding StreamLabs api endpoints as descriped in the Subscribe to Location Alerts section in the docs

Create Subscription

subscription_id = stream.subscribe_to_location_alerts(location_id, 'https://your-endpoint')['subscription_id']

Confirm subscription

Once you recieve the confirmationToken via your endpoint, update the subscription to start recieving alerts.

confirmation_token = 'CONFIRMATION_TOKEN'

subscription = stream.confirm_subscription(subscription_id, confirmation_token)

# subscription['status'] should be 'confirmed'

Get all Location Subscriptions

subscriptions = stream.get_location_subscriptions(location_id)

Get a Subscription

subscription = stream.get_subscription(subscription_id)

Get all Subscriptions

all_subscriptions = stream.get_subscriptions()

Delete a Subscription


This method will throw an Exception if the delete fails else returns a None

Get a Location’s Water Usage Summary

water_usage_summary = stream.get_location_water_usage_summary(location_id)

today = water_usage_summary['today']
this_month = water_usage_summary['thisMonth']
this_year = water_usage_summary['thisYear']
units = water_usage_summary['units']

Get a Location’s Water Usage

At the very minimum you need to provide a startTime for the reading you want to retrive.

from datetime import datetime, timezone, timedelta

yesterday = - timedelta(days=1)
start_time = yesterday.isoformat(timespec='seconds')

usage = stream.get_location_water_usage(location_id, {'startTime': start_time})


This project was heavily inspired by streamlabswater-python

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlabswater-streamlabswater-0.3.2.tar.gz (3.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page