Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new case for 449 response code #276

Merged
merged 4 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ The SDK is available on `PyPI <https://pypi.python.org/pypi/qds_sdk>`_.

From source
~~~~~~~~~~~
* Download the source code:
* Get the source code:

- Either clone the project: ``git clone [email protected]:qubole/qds-sdk-py.git``
- Either clone the project: ``git clone [email protected]:qubole/qds-sdk-py.git`` and checkout latest release tag from `Releases <https://github.com/qubole/qds-sdk-py/releases>`_.

- Or download one of the releases from https://github.com/qubole/qds-sdk-py/releases

Expand Down
5 changes: 4 additions & 1 deletion qds_sdk/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions qds_sdk/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down