Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

streamlabsio

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streamlabsio

Get real time Twitch/Youtube events through Streamlabs SocketIO API

  • 1.1.2
  • PyPI
  • Socket score

Maintainers
1

PyPI version License: MIT Poetry Code style: black Imports: isort

A Python client for Streamlabs Socket API

For an outline of past/future changes refer to: CHANGELOG

Requirements

  • A Streamlabs Socket API key.

    • You can acquire this by logging into your Streamlabs.com dashboard then Settings->Api Settings->API Tokens
  • Python 3.8 or greater

How to install using pip

pip install streamlabsio

How to Use

You may store your api key in a config.toml file, its contents should resemble:

[streamlabs]
token = "<apikey>"

Place it next to your __main__.py file.

Otherwise:

You may pass it as a keyword argument.

Example __main__.py:

import streamlabsio


def on_twitch_event(event, data):
    print(f"{event}: {data.attrs()}")


def main():
    with streamlabsio.connect(token="<apikey>") as client:
        client.obs.on("streamlabs", on_twitch_event)
        client.obs.on("twitch_account", on_twitch_event)

        # run for 30 seconds then disconnect client from server
        client.sio.sleep(30)


if __name__ == "__main__":
    main()
note

From the SocketIO docs, client.sio.wait() may be used if your application has nothing to do in the main thread.

Client class

streamlabsio.connect(token="<apikey>", raw=False)

The following keyword arguments may be passed:

  • token: str Streamlabs SocketIO api token.
  • raw: boolean=False Receive raw data messages as json objects.

The following attribute is available:

  • raw: boolean Toggle raw mode at runtime.

Attributes

For event data you may inspect the available attributes using attrs().

example:

def on_twitch_event(event, data):
    print(f"{event}: {data.attrs()}")

Errors

  • SteamlabsSIOError: Base StreamlabsSIO error class
  • SteamlabsSIOConnectionError: Exception raised when connection errors occur

Logging

To view raw incoming event data set logging level to DEBUG. Check debug example.

Official Documentation

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc