yahoo: More graceful handling of responses with meta but no timestamps.
This commit is contained in:
parent
ee8ca0573d
commit
77b2776e55
1 changed files with 7 additions and 2 deletions
|
@ -146,11 +146,10 @@ class Yahoo(BaseSource):
|
|||
raise exceptions.InvalidPair(
|
||||
series.base, series.quote, self, "Symbol not found."
|
||||
)
|
||||
if code == 400 and "Data doesn't exist" in text:
|
||||
elif code == 400 and "Data doesn't exist" in text:
|
||||
raise exceptions.BadResponse(
|
||||
"No data for the given interval. Try requesting a larger interval."
|
||||
)
|
||||
|
||||
elif code == 404 and "Timestamp data missing" in text:
|
||||
raise exceptions.BadResponse(
|
||||
"Data missing. The given interval may be for a gap in the data "
|
||||
|
@ -169,4 +168,10 @@ class Yahoo(BaseSource):
|
|||
"The data couldn't be parsed. "
|
||||
) from e
|
||||
|
||||
if "timestamp" not in data["chart"]["result"][0]:
|
||||
raise exceptions.BadResponse(
|
||||
"No data for the given interval. "
|
||||
"There may be a problem with the symbol or the interval."
|
||||
)
|
||||
|
||||
return data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue