-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gracefully exit when API rate limit is exceeded #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just had a few minor logging/documentation questions.
if site_xml_root == "E104": | ||
continue | ||
elif site_xml_root == "E107": | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably log these out to help future you/us debug things when we're missing data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They get logged in the shoppertrak_api_client (lines 206-223) so I think we're good
if response_root == "E104": | ||
return None | ||
elif response_root == "E108": | ||
if response_root == "E108": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General question: do we have any documentation on all of the error states that ShopperTrak can return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ShopperTrak sent us some documentation with the following error codes, which notably does not include E104, making me wonder whether there are other possible error codes not included in this list:
- E101: The Site ID supplied is not recognized by the system.
- E102: The format of the “date” value is not valid. The format must be YYYYMMDD.
- E103: The requested date value is older than 30 days.
- E105: The total property value is not valid. This value must either be “Y” or “N”.
- E106: The increment value is not valid. This value must either be “15” or “60”.
- E107: Customer has exceeded the maximum number of requests allowed in a 24 hour period.
- E108: The web service is busy, please try again later. It is recommended to wait at least 30 seconds before making another request.
It's expected that we exceed the API limit (100 daily requests) when checking for recovery data and therefore we should not throw an error when this happens.