Coder Social home page Coder Social logo

djamessuhanko / obs-websocket-py Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elektordi/obs-websocket-py

0.0 1.0 0.0 143 KB

Python library to communicate with an obs-websocket server (for OBS Studio)

License: MIT License

Python 100.00%

obs-websocket-py's Introduction

obs-websocket-py

Python library to communicate with an obs-websocket server.

Licensed under the MIT License

Project pages

GitHub project: https://github.com/Elektordi/obs-websocket-py

PyPI package: https://pypi.org/project/obs-websocket-py/

Installation

Just run pip install obs-websocket-py 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 obswebsocket.core.obsws:

Help on class obsws in obswebsocket.core:

obswebsocket.core.obsws = class obsws
 |  Core class for using obs-websocket-py
 |  
 |  Simple usage:
 |      >>> import obswebsocket, obswebsocket.requests
 |      >>> client = obswebsocket.obsws("localhost", 4444, "secret")
 |      >>> client.connect()
 |      >>> client.call(obswebsocket.requests.GetVersion()).getObsWebsocketVersion()
 |      u'4.1.0'
 |      >>> client.disconnect()
 |      
 |  For advanced usage, including events callback, see the 'samples' directory.
 |  
 |  Methods defined here:
 |  
 |  __init__(self, host=None, port=4444, password='')
 |      Construct a new obsws 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, function, event=None)
 |      Register a new hook in the websocket client
 |      
 |      :param function: 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 obj: Request (python dict) to send to the server. Do not include field "message-id".
 |      :return: Response (python dict) from the server.
 |  
 |  unregister(self, function, event=None)
 |      Unregister a new hook in the websocket client
 |      
 |      :param function: 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

Problems?

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

obs-websocket-py's People

Contributors

elektordi avatar picocentauri avatar adirio avatar thelan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.