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
1717 :members:
1818 :undoc-members:
1919
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):
1212 """
1313
1414 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 1010from ..logging import get_logger
1111import logging
1212from urllib .parse import urlencode
13- from ..exceptions import AuthError , BadResponse , NoResultsError
13+ from ..exceptions import AuthError , BadResponse
1414
1515logger = get_logger ("RESTClient" )
1616version = "unknown"
@@ -116,11 +116,7 @@ def _get(
116116
117117 if result_key :
118118 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 []
124120 obj = obj [result_key ]
125121
126122 if deserializer :
@@ -198,6 +194,8 @@ def _paginate_iter(
198194 options = options ,
199195 )
200196 decoded = self ._decode (resp )
197+ if result_key not in decoded :
198+ return []
201199 for t in decoded [result_key ]:
202200 yield deserializer (t )
203201 if "next_url" in decoded :
You can’t perform that action at this time.
0 commit comments