update examples to work with modified req client

examples now expect env variables
This commit is contained in:
2026-03-27 16:29:16 +00:00
parent 7126a2efe0
commit fe9f305afe
7 changed files with 62 additions and 33 deletions

View File

@@ -1,16 +1,21 @@
import os
import time
import obsws_python as obs
def main():
with obs.ReqClient() as client:
host = os.getenv("OBSWS_HOST", "localhost")
port = int(os.getenv("OBSWS_PORT", 4455))
password = os.getenv("OBSWS_PASSWORD", "")
with obs.ReqClient(host=host, port=port, password=password) as client:
resp = client.get_scene_list()
scenes = [di.get("sceneName") for di in reversed(resp.scenes)]
for scene in scenes:
print(f"Switching to scene {scene}")
client.set_current_program_scene(scene)
client.set_current_program_scene(scene_name=scene)
time.sleep(0.5)