Metadata-Version: 2.1
Name: obs-ws-client
Version: 0.1.0
Summary: A websocket client for OBS Studio in Python.
License: MIT
Keywords: obs,obs-studio,websocket,asyncio,client
Author: Elorfiniel
Author-email: markgenthusiastic@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: websockets (>=14.0,<15.0)
Project-URL: gitee, https://gitee.com/elorfiniel/obs-ws-client-python
Project-URL: github, https://github.com/Elorfiniel/obs-ws-client-python
Description-Content-Type: text/markdown

# OBS WebSocket Client

A Python library for interacting with OBS Studio through its WebSocket protocol (v5.x.x). This client provides a simple async interface to control OBS Studio programmatically.

## Features

- Support for [OBS WebSocket 5.x.x protocol](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md)
- Asynchronous interface using asyncio

## Requirements

- Python 3.9 or higher
- OBS Studio 28.0.0 or higher with WebSocket server enabled

## Installation

This package uses [Poetry](https://python-poetry.org/) for dependency management. Make sure you have installed Poetry (v1.8.3). Then simply run:

```bash
poetry install
```

## Setting up OBS WebSocket Server

1. Open OBS Studio
2. Go to Tools -> WebSocket Server Settings
3. Enable WebSocket server
4. Set the Server Port (default is 4455)
5. Optionally set the password for authentication

## Quickstart

Below is a simple code snippet that demonstrates the usage of ObsWsClient to start and stop recording in OBS Studio. For more examples, checkout the `example` folder.

```python
from obswsc.client import ObsWsClient
from obswsc.data import Request

import asyncio

async def main():
  client = ObsWsClient(url='ws://localhost:4455')

  async with client:
    await client.request(Request('StartRecord'))
    await asyncio.sleep(10.0)
    res = await client.request(Request('StopRecord'))
    print(f'recorded video: {res.res_data["outputPath"]}')

asyncio.run(main())
```

## License

This project is licensed under [the MIT License](LICENSE).

## Acknowledgments

- Thanks to the OBS Studio team for creating the WebSocket protocol.

