Skip to content

Commit

Permalink
Sleep one request earlier, in order to add more of a buffer if restar…
Browse files Browse the repository at this point in the history
…ting the program (due to the extra api call for verifying the key).
  • Loading branch information
johndoknjas committed Sep 22, 2024
1 parent ede7d7c commit 4def665
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hypickle/hypixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def getJSON(typeOfRequest: str, uuid_or_ign: Optional[str], specific_api_key: Op
f'typeOfRequest: {typeOfRequest}\nthere was a problem with response.json()'
) from e

if ('RateLimit-Remaining' in responseHeaders and int(responseHeaders['RateLimit-Remaining']) <= 1
if ('RateLimit-Remaining' in responseHeaders and int(responseHeaders['RateLimit-Remaining']) <= 2
and int(responseHeaders['RateLimit-Reset']) < 295):
# The < 295 condition is to not sleep when starting a new rate limit period, since it seems
# there's a bug in the api where the first response header gives a `RateLimit-Remaining` val that
Expand Down

0 comments on commit 4def665

Please sign in to comment.