Skip to content
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

Merged
merged 1 commit into from
May 17, 2024

Conversation

aaronfriedman6
Copy link
Contributor

@aaronfriedman6 aaronfriedman6 commented May 14, 2024

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.

@aaronfriedman6 aaronfriedman6 requested a review from mwbenowitz May 14, 2024 17:16
Copy link

@mwbenowitz mwbenowitz left a 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.

Comment on lines +186 to +189
if site_xml_root == "E104":
continue
elif site_xml_root == "E107":
break

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.

Copy link
Contributor Author

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":

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?

Copy link
Contributor Author

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.

@aaronfriedman6 aaronfriedman6 merged commit 15eae0c into main May 17, 2024
2 checks passed
@aaronfriedman6 aaronfriedman6 deleted the handle-rate-limit branch May 17, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants