Get real time Twitch/Youtube events through Streamlabs SocketIO API
Project description
A Python client for Streamlabs SocketIO API
Requirements
- A Streamlabs SocketIO 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
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
:
from threading import Thread
import streamlabsio
def on_twitch_event(event, msg):
print(f"{event}: {msg.attrs()}")
def register_callbacks(client):
client.obs.on("streamlabs", on_twitch_event)
client.obs.on("twitch_account", on_twitch_event)
def main():
with streamlabsio.connect(token="<apikey>") as client:
worker = Thread(target=register_callbacks, args=(client,), daemon=True)
worker.start()
while cmd := input("<Enter> to exit\n"):
if not cmd:
break
if __name__ == "__main__":
main()
Attributes
For event messages you may inspect the available attributes using attrs()
.
example:
def on_twitch_event(event, msg):
print(f"{event}: {msg.attrs()}")
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
streamlabsio-0.1.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for streamlabsio-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54b24ae0e4b20f00d723e5928abd5d89f553e803a2e0cdfe2f7c7696b4d131c4 |
|
MD5 | 991edb46069ef6018790750b9dba0667 |
|
BLAKE2b-256 | 22e03d25d96418b99f73d96a0d65cf081f057a08149e7c0316255a3f8a272a1d |