Compare commits

...

9 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
751b0d6e82 Release version 0.35.0 2020-08-05 12:02:21 -04:00
Jose Diaz-Gonzalez
ea633ca2bb Merge pull request #156 from samanthaq/restore-optional-throttling
Make API request throttling optional
2020-08-05 12:01:56 -04:00
Samantha Baldwin
a2115ce3e5 Make API request throttling optional 2020-08-05 11:53:17 -04:00
Jose Diaz-Gonzalez
8a00bb1903 Release version 0.34.0 2020-07-24 13:31:03 -04:00
Jose Diaz-Gonzalez
e53f8d4724 Merge pull request #153 from 0x6d617474/gist_ssh
Add logic for transforming gist repository urls to ssh
2020-07-24 13:30:40 -04:00
Matt Fields
356f5f674b Add logic for transforming gist repository urls to ssh 2020-07-07 17:54:16 -04:00
Jose Diaz-Gonzalez
13128635cb Release version 0.33.1 2020-05-28 16:44:40 -04:00
Jose Diaz-Gonzalez
6e6842b025 Merge pull request #151 from garymoon/readme-update-0.33 2020-05-28 16:43:57 -04:00
Gary Moon
272177c395 Update the readme for new switches added in 0.33 2020-05-26 19:59:47 -04:00
4 changed files with 29 additions and 5 deletions

View File

@@ -1,9 +1,19 @@
Changelog
=========
0.33.0 (2020-04-13)
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]
A simple approach to throttle API requests and so keep within the rate

View File

@@ -41,7 +41,8 @@ CLI Usage is as follows::
[-P] [-F] [--prefer-ssh] [-v]
[--keychain-name OSX_KEYCHAIN_ITEM_NAME]
[--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
[--releases] [--assets]
[--releases] [--assets] [--throttle-limit THROTTLE_LIMIT]
[--throttle-pause THROTTLE_PAUSE]
USER
Backup a github account
@@ -111,6 +112,13 @@ CLI Usage is as follows::
binaries
--assets include assets alongside release information; only
applies if including releases
--throttle-limit THROTTLE_LIMIT
start throttling of GitHub API requests after this
amount of API requests remain
--throttle-pause THROTTLE_PAUSE
wait this amount of seconds when API request
throttling is active (default: 30.0, requires
--throttle-limit to be set)
The package can be used to backup an *entire* organization or repository, including issues and wikis in the most appropriate format (clones for wikis, json files for issues).

View File

@@ -1 +1 @@
__version__ = '0.33.0'
__version__ = '0.35.0'

View File

@@ -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,