How to use the imjoy.imjoySocketIO_client.exceptions.ConnectionError function in imjoy

To help you get started, we’ve selected a few imjoy 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 oeway / ImJoy-Engine / imjoy / imjoySocketIO_client / transports.py View on Github external
def get_response(request, *args, **kw):
    try:
        response = request(*args, stream=True, **kw)
    except requests.exceptions.Timeout as e:
        raise TimeoutError(e)
    except requests.exceptions.ConnectionError as e:
        raise ConnectionError(e)
    except requests.exceptions.SSLError as e:
        raise ConnectionError("could not negotiate SSL (%s)" % e)
    status_code = response.status_code
    if 200 != status_code:
        raise ConnectionError(
            "unexpected status code (%s %s)" % (status_code, response.text)
        )
    return response
github oeway / ImJoy-Engine / imjoy / imjoySocketIO_client / transports.py View on Github external
def recv_packet(self):
        try:
            packet_text = self._connection.recv()
        except websocket.WebSocketTimeoutException as e:
            raise TimeoutError("recv timed out (%s)" % e)
        except SSLError as e:
            raise ConnectionError("recv disconnected by SSL (%s)" % e)
        except websocket.WebSocketConnectionClosedException as e:
            raise ConnectionError("recv disconnected (%s)" % e)
        except socket.error as e:
            raise ConnectionError("recv disconnected (%s)" % e)
        if not isinstance(packet_text, six.binary_type):
            packet_text = six.b(packet_text)
        engineIO_packet_type, engineIO_packet_data = parse_packet_text(packet_text)
        yield engineIO_packet_type, engineIO_packet_data
github oeway / ImJoy-Engine / imjoy / imjoySocketIO_client / transports.py View on Github external
def get_response(request, *args, **kw):
    try:
        response = request(*args, stream=True, **kw)
    except requests.exceptions.Timeout as e:
        raise TimeoutError(e)
    except requests.exceptions.ConnectionError as e:
        raise ConnectionError(e)
    except requests.exceptions.SSLError as e:
        raise ConnectionError("could not negotiate SSL (%s)" % e)
    status_code = response.status_code
    if 200 != status_code:
        raise ConnectionError(
            "unexpected status code (%s %s)" % (status_code, response.text)
        )
    return response
github oeway / ImJoy-Engine / imjoy / imjoySocketIO_client / transports.py View on Github external
def get_response(request, *args, **kw):
    try:
        response = request(*args, stream=True, **kw)
    except requests.exceptions.Timeout as e:
        raise TimeoutError(e)
    except requests.exceptions.ConnectionError as e:
        raise ConnectionError(e)
    except requests.exceptions.SSLError as e:
        raise ConnectionError("could not negotiate SSL (%s)" % e)
    status_code = response.status_code
    if 200 != status_code:
        raise ConnectionError(
            "unexpected status code (%s %s)" % (status_code, response.text)
        )
    return response
github oeway / ImJoy-Engine / imjoy / imjoySocketIO_client / transports.py View on Github external
kw["http_proxy_auth"] = (
                    proxy_url_pack.username,
                    proxy_url_pack.password,
                )
        if http_session.verify:
            if http_session.cert:  # Specify certificate path on disk
                if isinstance(http_session.cert, basestring):
                    kw["ca_certs"] = http_session.cert
                else:
                    kw["ca_certs"] = http_session.cert[0]
        else:  # Do not verify the SSL certificate
            kw["sslopt"] = {"cert_reqs": ssl.CERT_NONE}
        try:
            self._connection = websocket.create_connection(ws_url, **kw)
        except Exception as e:
            raise ConnectionError(e)