mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-05 08:08:02 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
751b0d6e82 | ||
|
|
ea633ca2bb | ||
|
|
a2115ce3e5 | ||
|
|
8a00bb1903 | ||
|
|
e53f8d4724 | ||
|
|
356f5f674b |
12
CHANGES.rst
12
CHANGES.rst
@@ -1,8 +1,18 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
0.33.1 (2020-05-28)
|
||||
0.35.0 (2020-08-05)
|
||||
-------------------
|
||||
------------------------
|
||||
- Make API request throttling optional. [Samantha Baldwin]
|
||||
|
||||
|
||||
0.34.0 (2020-07-24)
|
||||
-------------------
|
||||
- Add logic for transforming gist repository urls to ssh. [Matt Fields]
|
||||
|
||||
|
||||
0.33.0 (2020-04-13)
|
||||
-------------------
|
||||
- Add basic API request throttling. [Enrico Tröger]
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = '0.33.1'
|
||||
__version__ = '0.35.0'
|
||||
|
||||
@@ -419,7 +419,13 @@ def get_github_host(args):
|
||||
|
||||
def get_github_repo_url(args, repository):
|
||||
if repository.get('is_gist'):
|
||||
return repository['git_pull_url']
|
||||
if args.prefer_ssh:
|
||||
# The git_pull_url value is always https for gists, so we need to transform it to ssh form
|
||||
repo_url = re.sub('^https?:\/\/(.+)\/(.+)\.git$', r'git@\1:\2.git', repository['git_pull_url'])
|
||||
repo_url = re.sub('^git@gist\.', 'git@', repo_url) # strip gist subdomain for better hostkey compatibility
|
||||
else:
|
||||
repo_url = repository['git_pull_url']
|
||||
return repo_url
|
||||
|
||||
if args.prefer_ssh:
|
||||
return repository['ssh_url']
|
||||
@@ -451,7 +457,7 @@ def retrieve_data_gen(args, template, query_args=None, single_request=False):
|
||||
status_code = int(r.getcode())
|
||||
# be gentle with API request limit and throttle requests if remaining requests getting low
|
||||
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(
|
||||
'API request limit hit: {} requests left, pausing further requests for {}s'.format(
|
||||
limit_remaining,
|
||||
|
||||
Reference in New Issue
Block a user