How to use the pywebostv.connection.WebOSWebSocketClient function in pywebostv

To help you get started, we’ve selected a few pywebostv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github supersaiyanmode / PyWebOSTV / pywebostv / controls.py View on Github external
def __init__(self, *args, **kwargs):
        self.ws_class = kwargs.pop('ws_class', WebOSWebSocketClient)
        super(InputControl, self).__init__(*args, **kwargs)
github supersaiyanmode / PyWebOSTV / pywebostv / connection.py View on Github external
"serial": "2f930e2d2cfe083771f68e4fe7bb07",
            "vendorId": "com.lge"
        }
    },
    "pairingType": "PROMPT"
}


class WebOSWebSocketClient(WebSocketClient):
    @property
    def handshake_headers(self):
        headers = super(WebOSWebSocketClient, self).handshake_headers
        return [(k, v) for k, v in headers if k.lower() != 'origin']


class WebOSClient(WebOSWebSocketClient):
    PROMPTED = 1
    REGISTERED = 2

    def __init__(self, host):
        ws_url = "ws://{}:3000/".format(host)
        super(WebOSClient, self).__init__(ws_url)
        self.waiters = {}
        self.waiter_lock = RLock()
        self.subscribers = {}
        self.subscriber_lock = RLock()
        self.send_lock = RLock()

    @staticmethod
    def discover():
        res = discover("urn:schemas-upnp-org:device:MediaRenderer:1",
                       keyword="LG", hosts=True, retries=3)
github supersaiyanmode / PyWebOSTV / pywebostv / connection.py View on Github external
def handshake_headers(self):
        headers = super(WebOSWebSocketClient, self).handshake_headers
        return [(k, v) for k, v in headers if k.lower() != 'origin']