obsws-python/README.md

53 lines
1.3 KiB
Markdown
Raw Normal View History

# obs_sdk
### A Python SDK for OBS Studio WebSocket v5.0
This is a wrapper around OBS Websocket.
Not all endpoints in the official documentation are implemented. But all endpoints in the Requests section is implemented. You can find the relevant document using below link.
[obs-websocket github page](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#Requests)
## Requirements
- [OBS Studio](https://obsproject.com/)
- [OBS Websocket v5 Plugin](https://github.com/obsproject/obs-websocket/releases/tag/5.0.0)
- Python 3.11 or greater
### How to install using pip
```
pip install obsstudio-sdk
```
### How to Use
- Load connection info from toml config. A valid `config.toml` might look like this:
```toml
[connection]
host = "localhost"
port = 4455
password = "mystrongpass"
```
It should be placed next to your `__main__.py` file.
Otherwise:
- Import and start using
Parameters are as follows:
host: obs websocket server
port: port to access server
password: obs websocket server password
2022-07-26 22:05:09 +01:00
Example `__main__.py`
2022-07-26 22:05:09 +01:00
```python
from obsstudio_sdk.reqs import ReqClient
2022-07-26 22:05:09 +01:00
# pass conn info if not in config.toml
cl = ReqClient('localhost', 4455, 'mystrongpass')
2022-07-26 22:05:09 +01:00
# Toggle the mute state of your Mic input
2022-07-26 22:06:06 +01:00
cl.toggle_input_mute('Mic/Aux')
```