def wait_rate_limit_reset(now):
reset = (
datetime.utcfromtimestamp(GITHUB.x_ratelimit_reset)
.replace(tzinfo=timezone.utc)
)
delta = reset - now
wait = delta.total_seconds() + .5
if wait < 1 or 3500 < wait:
# Our data is outdated. Just go on.
return 0
logger.warning("Waiting rate limit reset in %s seconds.", wait)
time.sleep(wait)
GITHUB._instance.x_ratelimit_remaining = -1
return wait
评论列表
文章目录