How to use the jsonrpcclient.exceptions.ConnectionError function in jsonrpcclient

To help you get started, we’ve selected a few jsonrpcclient 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 bcb / jsonrpcclient / test / unit / test_exceptions.py View on Github external
def test_ConnectionError(self):
        with self.assertRaises(exceptions.ConnectionError):
            raise exceptions.ConnectionError
github bcb / jsonrpcclient / test / unit / test_exceptions.py View on Github external
def test_ConnectionError(self):
        with self.assertRaises(exceptions.ConnectionError):
            raise exceptions.ConnectionError
github bcb / jsonrpcclient / jsonrpcclient / proxy.py View on Github external
headers={
                    'Content-Type': 'application/json; charset=utf-8'
                },
                json=request_dict
            )

            # Log the response
            self.logger.debug('<-- '+r.text \
                .replace("\n",'') \
                .replace('  ', ' ')
                .replace('{ ', '{')
                )

        except (requests.exceptions.InvalidSchema,
                requests.exceptions.RequestException):
            raise exceptions.ConnectionError()

        # Raise exception the HTTP status code was not 200, and there was no
        # response body, because this should be handled.
        if not len(r.text) and r.status_code != 200:
            raise exceptions.StatusCodeError(r.status_code)

        return r.text