Skip to content

Instantly share code, notes, and snippets.

@onyx-and-iris
Last active July 22, 2025 01:26
Show Gist options
  • Save onyx-and-iris/c65ed516777bc079675122097f0b6c07 to your computer and use it in GitHub Desktop.
Save onyx-and-iris/c65ed516777bc079675122097f0b6c07 to your computer and use it in GitHub Desktop.
Shutdown OBS over websocket using the obs-shutdown-plugin
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