Skip to main content

Python library to communicate with an obs-websocket server.

Project description

pyobs

Python library to communicate with an obs-websocket server.

Licensed under the MIT License

Project pages

GitHub project: https://github.com/Adirio/pyobs

PyPI package: https://pypi.python.org/pypi/pyobs

Installation

Just run pip install pyobs in your Python venv or directly on your system.

For manual install, git clone the github repo and copy the directory obswebsocket in your python project root.

Requires: websocket-client (from pip)

Usage

See python scripts in the samples directory.

Or take a look at the documentation below:

Output of pydoc pyobs.Client:

Help on class Client in pyobs:

pyobs.Client = class Client(builtins.object)
 |  Core class for using pyobs
 |
 |  Simple usage:
 |      >>> from pyobs import Client, requests as obsrequests
 |      >>> client = Client("localhost", 4444, "secret")
 |      >>> client.connect()
 |      >>> client.call(obsrequests.GetVersion()).getObsWebsocketVersion()
 |      u'4.1.0'
 |      >>> client.disconnect()
 |
 |  For advanced usage, including events callback, see the 'samples' directory.
 |
 |  Methods defined here:
 |
 |  __init__(self, host='localhost', port=4444, password='')
 |      Construct a new Client wrapper
 |
 |      :param host: Hostname to connect to
 |      :param port: TCP Port to connect to (Default is 4444)
 |      :param password: Password for the websocket server (Leave this field
 |          empty if no auth enabled on the server)
 |
 |  call(self, obj)
 |      Make a call to the OBS server through the Websocket.
 |
 |      :param obj: Request (class from obswebsocket.requests module) to send
 |          to the server.
 |      :return: Request object populated with response data.
 |
 |  connect(self, host=None, port=None)
 |      Connect to the websocket server
 |
 |      :return: Nothing
 |
 |  disconnect(self)
 |      Disconnect from websocket server
 |
 |      :return: Nothing
 |
 |  reconnect(self)
 |      Restart the connection to the websocket server
 |
 |      :return: Nothing
 |
 |  register(self, func, event=None)
 |      Register a new hook in the websocket client
 |
 |      :param func: Callback function pointer for the hook
 |      :param event: Event (class from obswebsocket.events module) to trigger
 |          the hook on. Default is None, which means trigger on all events.
 |      :return: Nothing
 |
 |  send(self, data)
 |      Make a raw json call to the OBS server through the Websocket.
 |
 |      :param data: Request (python dict) to send to the server. Do not
 |          include field "message-id".
 |      :return: Response (python dict) from the server.
 |
 |  unregister(self, func, event=None)
 |      Unregister a new hook in the websocket client
 |
 |      :param func: Callback function pointer for the hook
 |      :param event: Event (class from obswebsocket.events module) which
 |          triggered the hook on. Default is None, which means unregister this
 |          function for all events.
 |      :return: Nothing
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables (if defined)
 |
 |  __weakref__
 |      list of weak references to the object (if defined)

Problems?

Please check on Github project issues, and if nobody else have experienced it before, you can file a new issue.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyobs-0.1.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyobs-0.1-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file pyobs-0.1.tar.gz.

File metadata

  • Download URL: pyobs-0.1.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.4

File hashes

Hashes for pyobs-0.1.tar.gz
Algorithm Hash digest
SHA256 60f69dc65f761ce83da0afe30d84572d8ad5dab2178ae2966c9e4cf42a935a6e
MD5 053be0e5ddb093511f62038f76fb7b3f
BLAKE2b-256 68bb58bcb907555e27e07ef7c31d83dde9ff4198bb10cbb5ee93ec72a1bd9606

See more details on using hashes here.

File details

Details for the file pyobs-0.1-py3-none-any.whl.

File metadata

  • Download URL: pyobs-0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.4

File hashes

Hashes for pyobs-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c6fe613f715f714663228df3ebd5b78ed1ffc9c5984666995f46063acc9b057
MD5 4d8b7b50aabdec52d165a316970bae32
BLAKE2b-256 5736f63e8e878eef91363936c175f3183cf7cd2ab70b8b6a762e44f529443b19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page