Get real time Twitch/Youtube events through Streamlabs SocketIO API
Project description
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
- You can acquire this by logging into your Streamlabs.com dashboard then
-
Python 3.10 or greater
Install
pip install streamlabsio
Use
import streamlabsio
def on_streamlabs_event(event, data):
print(f'{event}: {data.attrs()}')
def on_twitch_event(event, data):
if event == 'follow':
print(f'{data.name} just followed!')
def main():
with streamlabsio.connect(token="<API token>") as client:
client.obs.on('streamlabs', on_streamlabs_event)
client.obs.on('twitch_account', on_twitch_event)
# run for 30 seconds then disconnect client from server
client.wait(30)
if __name__ == '__main__':
main()
Client class
streamlabsio.connect(*, token: str, raw: bool = False) -> Client
The following keyword arguments may be passed:
- token: Streamlabs SocketIO api token.
- raw: Receive raw data messages as json objects.
methods
wait(self, seconds: float | None = None) -> None
- float: Time in seconds to block the main thread
- If None, the method will block indefinitely.
Event Data 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 classSteamlabsSIOConnectionError: Exception raised when connection errors occur
Logging
To view the logs emitted by the streamlabsio library simply add the following to your code:
from loguru import logger
logger.enable('streamlabsio')
Official Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlabsio-2.0.0.tar.gz.
File metadata
- Download URL: streamlabsio-2.0.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92041acf4d1863db3a2439b02f61625e8c80fc55b416a36a21a7fc16d0f8e847
|
|
| MD5 |
5059518300133bd86fff172ab3cfa455
|
|
| BLAKE2b-256 |
d505f45b50586fb04bb3491583dc04a79e77b090fec152c4f3edf5c7c11f6323
|
Provenance
The following attestation bundles were made for streamlabsio-2.0.0.tar.gz:
Publisher:
publish.yml on onyx-and-iris/streamlabs-socketio-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streamlabsio-2.0.0.tar.gz -
Subject digest:
92041acf4d1863db3a2439b02f61625e8c80fc55b416a36a21a7fc16d0f8e847 - Sigstore transparency entry: 1205947359
- Sigstore integration time:
-
Permalink:
onyx-and-iris/streamlabs-socketio-py@78f9fc7f532ca93fa9fdeed9ad5020cf2188cb68 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/onyx-and-iris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@78f9fc7f532ca93fa9fdeed9ad5020cf2188cb68 -
Trigger Event:
push
-
Statement type:
File details
Details for the file streamlabsio-2.0.0-py3-none-any.whl.
File metadata
- Download URL: streamlabsio-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff952e7e9e4e7a90f87fc15bf7eef27c59bc68e87bb0de6f14d2910e1869be5b
|
|
| MD5 |
f3ef2dc57de24e1d2a709e40a490b261
|
|
| BLAKE2b-256 |
b276246ed370a55838110cd12e69161c3af39f84cf8c75740ba9778e6e7b3d27
|
Provenance
The following attestation bundles were made for streamlabsio-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on onyx-and-iris/streamlabs-socketio-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streamlabsio-2.0.0-py3-none-any.whl -
Subject digest:
ff952e7e9e4e7a90f87fc15bf7eef27c59bc68e87bb0de6f14d2910e1869be5b - Sigstore transparency entry: 1205947360
- Sigstore integration time:
-
Permalink:
onyx-and-iris/streamlabs-socketio-py@78f9fc7f532ca93fa9fdeed9ad5020cf2188cb68 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/onyx-and-iris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@78f9fc7f532ca93fa9fdeed9ad5020cf2188cb68 -
Trigger Event:
push
-
Statement type: