Last active
July 22, 2025 01:26
-
-
Save onyx-and-iris/c65ed516777bc079675122097f0b6c07 to your computer and use it in GitHub Desktop.
Shutdown OBS over websocket using the obs-shutdown-plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
import obsws_python as obsws | |
Version = namedtuple("Version", ["obs", "websocket"]) | |
def version(client) -> namedtuple: | |
resp = client.get_version() | |
return Version(resp.obs_version, resp.obs_web_socket_version) | |
with obsws.ReqClient() as client: | |
ver = version(client) | |
print( | |
f"Running OBS version:{ver.obs} with websocket version:{ver.websocket}" | |
) | |
resp = client.send( | |
'CallVendorRequest', | |
{ | |
'vendorName': 'obs-shutdown-plugin', | |
'requestType': 'shutdown', | |
'requestData': { | |
'reason': 'Testing shutdown', | |
'support_url': 'https://github.com/norihiro/obs-shutdown-plugin/issues', | |
'force': True, | |
}, | |
}, | |
) | |
print(resp.vendor_name, resp.request_type, resp.response_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment