##// END OF EJS Templates
a bit of cache and logging cleanup in gh_api
MinRK -
Show More
@@ -17,9 +17,9 b' import json'
17 try:
17 try:
18 import requests_cache
18 import requests_cache
19 except ImportError:
19 except ImportError:
20 print("no cache")
20 print("no cache", file=sys.stderr)
21 else:
21 else:
22 requests_cache.install_cache("gh_api")
22 requests_cache.install_cache("gh_api", expire_after=3600)
23
23
24 # Keyring stores passwords by a 'username', but we're not storing a username and
24 # Keyring stores passwords by a 'username', but we're not storing a username and
25 # password
25 # password
@@ -124,7 +124,11 b' def get_paged_request(url, headers=None, **params):'
124 results = []
124 results = []
125 params.setdefault("per_page", 100)
125 params.setdefault("per_page", 100)
126 while True:
126 while True:
127 print("fetching %s with %s" % (url, params), file=sys.stderr)
127 if '?' in url:
128 params = None
129 print("fetching %s" % url, file=sys.stderr)
130 else:
131 print("fetching %s with %s" % (url, params), file=sys.stderr)
128 response = requests.get(url, headers=headers, params=params)
132 response = requests.get(url, headers=headers, params=params)
129 response.raise_for_status()
133 response.raise_for_status()
130 results.extend(response.json())
134 results.extend(response.json())
General Comments 0
You need to be logged in to leave comments. Login now