You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to get the ratings for 'AAPL' today, I came across the above error. Specifically, I get:
pydantic.error_wrappers.ValidationError: 1 validation error for Rating
pt_prior
value is not a valid float (type=type_error.float)
Debugging the data, it appears sometimes the JSON returns the key but with an empty value which I think is what is throwing the exception.
Adding the code below seems to fix things:
pt_prior: Optional[float] = None
+ @pydantic.validator('pt_prior', pre=True)
+ def pt_prior_blank_string(value, field):
+ if value == "":
+ return None
+ return value
url_calendar: Optional[str] = None
Hope this helps.
Thanks for all your hard work.
The text was updated successfully, but these errors were encountered:
When attempting to get the ratings for 'AAPL' today, I came across the above error. Specifically, I get:
Debugging the data, it appears sometimes the JSON returns the key but with an empty value which I think is what is throwing the exception.
Adding the code below seems to fix things:
Hope this helps.
Thanks for all your hard work.
The text was updated successfully, but these errors were encountered: