Skip to content

Commit 859131b

Browse files
DLPLAT-999/handling-errors: Errors were not being reported correctly (#23)
1 parent 1e81355 commit 859131b

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 1.0.3 - 2022-08-07
2+
3+
* Fixes an issue with errors not being reported correctly.
4+
15
### 1.0.2 - 2022-05-02
26

37
* Fixes an issue with sessions not respecting proxy settings.

nasdaqdatalink/connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ def handle_api_error(cls, resp):
9797

9898
# if our app does not form a proper data_link_error response
9999
# throw generic error
100-
if 'error' not in error_body:
100+
if 'quandl_error' not in error_body:
101101
raise DataLinkError(http_status=resp.status_code, http_body=resp.text)
102102

103-
code = error_body['error']['code']
104-
message = error_body['error']['message']
103+
code = error_body['quandl_error']['code']
104+
message = error_body['quandl_error']['message']
105105
prog = re.compile('^QE([a-zA-Z])x')
106106
if prog.match(code):
107107
code_letter = prog.match(code).group(1)

nasdaqdatalink/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '1.0.2'
1+
VERSION = '1.0.3'

test/test_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_nasdaqdatalink_exceptions_no_retries(self, request_method):
3535
httpretty.register_uri(getattr(httpretty, request_method),
3636
"https://data.nasdaq.com/api/v3/databases",
3737
responses=[httpretty.Response(body=json.dumps(
38-
{'error':
38+
{'quandl_error':
3939
{'code': x[0], 'message': 'something went wrong'}}),
4040
status=x[1]) for x in data_link_errors]
4141
)

test/test_database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_bulk_download_raises_exception_when_error_response(self):
179179
re.compile(
180180
'https://data.nasdaq.com/api/v3/databases/*'),
181181
body=json.dumps(
182-
{'error':
182+
{'quandl_error':
183183
{'code': 'QEMx01', 'message': 'something went wrong'}}),
184184
status=500)
185185

test/test_datatable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_bulk_download_table_raises_exception_when_error_response(self, request_
186186
ApiConfig.number_of_retries = 2
187187
error_responses = [httpretty.Response(
188188
body=json.dumps(
189-
{'error': {'code': 'QEMx01', 'message': 'something went wrong'}}
189+
{'quandl_error': {'code': 'QEMx01', 'message': 'something went wrong'}}
190190
),
191191
status=500)]
192192

test/test_retries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def setUpClass(cls):
3939

4040
cls.error_response = httpretty.Response(
4141
body=json.dumps(
42-
{'error': {'code': 'QEMx01', 'message': 'something went wrong'}}
42+
{'quandl_error': {'code': 'QEMx01', 'message': 'something went wrong'}}
4343
),
4444
status=500)
4545
cls.success_response = httpretty.Response(body=json.dumps(cls.datatable), status=200)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy