diff --git a/README.rst b/README.rst index 46a6ba14..3551794d 100644 --- a/README.rst +++ b/README.rst @@ -21,9 +21,9 @@ The SDK is available on `PyPI `_. From source ~~~~~~~~~~~ -* Download the source code: +* Get the source code: - - Either clone the project: ``git clone git@github.com:qubole/qds-sdk-py.git`` + - Either clone the project: ``git clone git@github.com:qubole/qds-sdk-py.git`` and checkout latest release tag from `Releases `_. - Or download one of the releases from https://github.com/qubole/qds-sdk-py/releases diff --git a/qds_sdk/connection.py b/qds_sdk/connection.py index ede6c412..0398acb5 100644 --- a/qds_sdk/connection.py +++ b/qds_sdk/connection.py @@ -152,9 +152,12 @@ def _handle_error(response): elif code == 422: sys.stderr.write(response.text + "\n") raise ResourceInvalid(response) - elif code in (449, 502, 503, 504): + elif code in (502, 503, 504): sys.stderr.write(response.text + "\n") raise RetryWithDelay(response) + elif code == 449: + sys.stderr.write(response.text + "\n") + raise RetryWithDelay(response, "Data requested is unavailable. Retrying ...") elif 401 <= code < 500: sys.stderr.write(response.text + "\n") raise ClientError(response) diff --git a/qds_sdk/exception.py b/qds_sdk/exception.py index 5e361902..ef06a335 100644 --- a/qds_sdk/exception.py +++ b/qds_sdk/exception.py @@ -11,8 +11,9 @@ def __init__(self, message, usage): class Error(Exception): """A general error derived from Exception.""" - def __init__(self, request): - Exception.__init__(self, request.text) + def __init__(self, request, message = ""): + response = message if message else request.text + Exception.__init__(self, response) self.request = request