File tree Expand file tree Collapse file tree 3 files changed +4
-21
lines changed Expand file tree Collapse file tree 3 files changed +4
-21
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,3 @@ BadResponse
17
17
:members:
18
18
:undoc-members:
19
19
20
- ==============================================================
21
- NoResultsError
22
- ==============================================================
23
- .. autoclass :: polygon.exceptions.NoResultsError
24
- :members:
25
- :undoc-members:
26
-
Original file line number Diff line number Diff line change @@ -12,11 +12,3 @@ class BadResponse(Exception):
12
12
"""
13
13
14
14
pass
15
-
16
-
17
- class NoResultsError (Exception ):
18
- """
19
- Missing results key
20
- """
21
-
22
- pass
Original file line number Diff line number Diff line change 10
10
from ..logging import get_logger
11
11
import logging
12
12
from urllib .parse import urlencode
13
- from ..exceptions import AuthError , BadResponse , NoResultsError
13
+ from ..exceptions import AuthError , BadResponse
14
14
15
15
logger = get_logger ("RESTClient" )
16
16
version = "unknown"
@@ -116,11 +116,7 @@ def _get(
116
116
117
117
if result_key :
118
118
if result_key not in obj :
119
- raise NoResultsError (
120
- f'Expected key "{ result_key } " in response { obj } .'
121
- + "Make sure you have sufficient permissions and your request parameters are valid."
122
- + f"This is the url that returned no results: { resp .geturl ()} "
123
- )
119
+ return []
124
120
obj = obj [result_key ]
125
121
126
122
if deserializer :
@@ -198,6 +194,8 @@ def _paginate_iter(
198
194
options = options ,
199
195
)
200
196
decoded = self ._decode (resp )
197
+ if result_key not in decoded :
198
+ return []
201
199
for t in decoded [result_key ]:
202
200
yield deserializer (t )
203
201
if "next_url" in decoded :
You can’t perform that action at this time.
0 commit comments