Get real time Twitch/Youtube events through Streamlabs SocketIO API
Project description
A Python client for Streamlabs Socket API
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
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, msg):
print(f"{event}: {msg.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.
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.3.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for streamlabsio-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08c46a3647abb587c5d233c3afaaef1e4c7adfb8b254e7f977144e42281e82e2 |
|
MD5 | 840b818a190ab029d5cbd873ea83c4a5 |
|
BLAKE2b-256 | 6a0c3ed556b3d662e1a56f171a4ce822125a0a92d4c0a5e4f16df412d047b79e |