{"id":30049893,"url":"https://github.com/aatikturk/obsws-python","last_synced_at":"2025-12-13T22:06:43.098Z","repository":{"id":50467427,"uuid":"500081089","full_name":"aatikturk/obsws-python","owner":"aatikturk","description":"A Python SDK for OBS Studio WebSocket v5.0","archived":false,"fork":false,"pushed_at":"2025-07-01T08:20:00.000Z","size":166,"stargazers_count":100,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-01T09:28:47.100Z","etag":null,"topics":["obs","obs-websocket","obs-websocket-5","obs-websocket-python","obs-websocket-v5"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aatikturk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-06-05T11:42:00.000Z","updated_at":"2025-07-01T08:20:05.000Z","dependencies_parsed_at":"2024-01-13T22:54:14.170Z","dependency_job_id":"eb854140-f18d-4003-8f19-b715d9188a31","html_url":"https://github.com/aatikturk/obsws-python","commit_stats":{"total_commits":81,"total_committers":5,"mean_commits":16.2,"dds":0.3827160493827161,"last_synced_commit":"9c41f2bb593c20fa4fe558b802b6511d8585f22c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aatikturk/obsws-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatikturk%2Fobsws-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatikturk%2Fobsws-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatikturk%2Fobsws-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatikturk%2Fobsws-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aatikturk","download_url":"https://codeload.github.com/aatikturk/obsws-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatikturk%2Fobsws-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269252964,"owners_count":24385908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["obs","obs-websocket","obs-websocket-5","obs-websocket-python","obs-websocket-v5"],"created_at":"2025-08-07T12:04:26.288Z","updated_at":"2025-12-13T22:06:37.779Z","avatar_url":"https://github.com/aatikturk.png","language":"Python","funding_links":[],"categories":["Install from Source"],"sub_categories":["Video and Audio Processing"],"readme":"[![PyPI version](https://badge.fury.io/py/obsws-python.svg)](https://badge.fury.io/py/obsws-python)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/aatikturk/obsstudio_sdk/blob/main/LICENSE)\n[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat\u0026labelColor=ef8336)](https://pycqa.github.io/isort/)\n\n# A Python SDK for OBS Studio WebSocket v5.0\n\nNot all endpoints in the official documentation are implemented.\n\n## Requirements\n\n- [OBS Studio](https://obsproject.com/)\n- [OBS Websocket v5 Plugin](https://github.com/obsproject/obs-websocket/releases/tag/5.0.0)\n  - With the release of OBS Studio version 28, Websocket plugin is included by default. But it should be manually installed for earlier versions of OBS.\n- Python 3.9 or greater\n\n### How to install using pip\n\n```\npip install obsws-python\n```\n\n### How to Use\n\nBy default the clients connect with parameters:\n\n- `host`: \"localhost\"\n- `port`: 4455\n- `password`: \"\"\n- `timeout`: None\n\nYou may override these parameters by storing them in a toml config file or passing them as keyword arguments.\n\nOrder of precedence: keyword arguments then config file then default values.\n\n#### `config file`\n\nA valid `config.toml` might look like this:\n\n```toml\n[connection]\nhost = \"localhost\"\nport = 4455\npassword = \"mystrongpass\"\n```\n\nIt should be placed in your user home directory.\n\n#### Otherwise:\n\nExample `__main__.py`:\n\n```python\nimport obsws_python as obs\n\n# pass conn info if not in config.toml\ncl = obs.ReqClient(host='localhost', port=4455, password='mystrongpass', timeout=3)\n\n# Toggle the mute state of your Mic input\ncl.toggle_input_mute('Mic/Aux')\n```\n\n### Requests\n\nMethod names for requests match the API calls but snake cased. If a successful call is made with the Request client and the response is expected to contain fields then a response object will be returned. You may then access the response fields as class attributes. They will be snake cased.\n\nexample:\n\n```python\n# load conn info from config.toml\ncl = obs.ReqClient()\n\n# GetVersion, returns a response object\nresp = cl.get_version()\n# Access it's field as an attribute\nprint(f\"OBS Version: {resp.obs_version}\")\n\n\n# SetCurrentProgramScene\ncl.set_current_program_scene(\"BRB\")\n```\n\n#### `send(param, data=None, raw=False)`\n\nIf you prefer to work with the JSON data directly the {ReqClient}.send() method accepts an argument, `raw`. If set to True the raw response data will be returned, instead of a response object.\n\nexample:\n\n```python\nresp = cl_req.send(\"GetVersion\", raw=True)\n\nprint(f\"response data: {resp}\")\n```\n\nFor a full list of requests refer to [Requests][obsws-reqs]\n\n### Events\n\nWhen registering a callback function use the name of the expected API event in snake case form, prepended with \"on\\_\".\n\nexample:\n\n```python\n# load conn info from config.toml\ncl = obs.EventClient()\n\ndef on_scene_created(data):\n    ...\n\n# SceneCreated\ncl.callback.register(on_scene_created)\n\ndef on_input_mute_state_changed(data):\n    ...\n\n# InputMuteStateChanged\ncl.callback.register(on_input_mute_state_changed)\n\n# returns a list of currently registered events\nprint(cl.callback.get())\n\n# You may also deregister a callback\ncl.callback.deregister(on_input_mute_state_changed)\n```\n\n`register(fns)` and `deregister(fns)` accept both single functions and lists of functions.\n\nFor a full list of events refer to [Events][obsws-events]\n\n### Attributes\n\nFor both request responses and event data you may inspect the available attributes using `attrs()`.\n\nexample:\n\n```python\nresp = cl.get_version()\nprint(resp.attrs())\n\ndef on_scene_created(data):\n    print(data.attrs())\n```\n\n### Errors\n\n- `OBSSDKError`: Base error class.\n- `OBSSDKTimeoutError`: Raised if a timeout occurs during sending/receiving a request or receiving an event\n- `OBSSDKRequestError`: Raised when a request returns an error code.\n  - The following attributes are available:\n    - `req_name`: name of the request.\n    - `code`: request status code.\n  - For a full list of status codes refer to [Codes][obsws-codes]\n\n### Logging\n\nIf you want to see the raw messages simply set log level to DEBUG\n\nexample:\n\n```python\nimport obsws_python as obs\nimport logging\n\n\nlogging.basicConfig(level=logging.DEBUG)\n...\n```\n\n### Tests\n\nInstall [hatch][hatch-install] and then:\n\n```\nhatch test\n```\n\n### Official Documentation\n\nFor the full documentation:\n\n- [OBS Websocket SDK][obsws-pro]\n\n\n[obsws-reqs]: https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#requests\n[obsws-events]: https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#events\n[obsws-codes]: https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#requeststatus\n[obsws-pro]: https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#obs-websocket-501-protocol\n[hatch-install]: https://hatch.pypa.io/latest/install/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faatikturk%2Fobsws-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faatikturk%2Fobsws-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faatikturk%2Fobsws-python/lists"}