mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-05 08:08:02 +01:00
Merge pull request #156 from samanthaq/restore-optional-throttling
Make API request throttling optional
This commit is contained in:
@@ -457,7 +457,7 @@ def retrieve_data_gen(args, template, query_args=None, single_request=False):
|
|||||||
status_code = int(r.getcode())
|
status_code = int(r.getcode())
|
||||||
# be gentle with API request limit and throttle requests if remaining requests getting low
|
# be gentle with API request limit and throttle requests if remaining requests getting low
|
||||||
limit_remaining = int(r.headers.get('x-ratelimit-remaining', 0))
|
limit_remaining = int(r.headers.get('x-ratelimit-remaining', 0))
|
||||||
if limit_remaining <= args.throttle_limit:
|
if args.throttle_limit and limit_remaining <= args.throttle_limit:
|
||||||
log_info(
|
log_info(
|
||||||
'API request limit hit: {} requests left, pausing further requests for {}s'.format(
|
'API request limit hit: {} requests left, pausing further requests for {}s'.format(
|
||||||
limit_remaining,
|
limit_remaining,
|
||||||
|
|||||||
Reference in New Issue
Block a user