summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2021-08-09 18:11:52 -0500
committerKelley Spoon <kelley.spoon@linaro.org>2021-08-09 19:29:01 -0500
commitd3fbf39060464f9140d9225562e2b7d9adf4a50a (patch)
tree1d03f599fdc85c8f33bb43f708dfba4d64659ed3
parenta664f17a4b0b8d4de6f8c3813cc675f5813de417 (diff)
sync_github_changes.py:
For some reason, a few of these projects are returning a 404 whenever you attempt to list pull requests through the API. We should avoid exiting and instead gracefully continue execution so we don't changes from other projects. Change-Id: I5ffeafc1587a5888640f50bbc89acbbc5fd26ab2
-rwxr-xr-xlinaro_metrics/sync_github_changes.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/linaro_metrics/sync_github_changes.py b/linaro_metrics/sync_github_changes.py
index 682b22f..33d41be 100755
--- a/linaro_metrics/sync_github_changes.py
+++ b/linaro_metrics/sync_github_changes.py
@@ -113,9 +113,15 @@ def _get(url):
try:
return urllib2.urlopen(request)
except urllib2.HTTPError as e:
+ error_code = e.getcode()
log.error('HTTP_%d while GETing %s:\n %s',
- e.getcode(), url, e.readlines())
- sys.exit(1)
+ error_code, url, e.readlines())
+ # 404 not found shouldn't be fatal.. make this
+ # a list in case there are others
+ if error_code in [404]:
+ return None
+ else:
+ sys.exit(1)
def get_pull_requests(owner, repo, last_update=None):
@@ -124,6 +130,8 @@ def get_pull_requests(owner, repo, last_update=None):
url = url % (owner, repo)
while url:
resp = _get(url)
+ if resp is None:
+ return
data = json.loads(resp.read())
for x in data:
ts = datetime.strptime(x['updated_at'], '%Y-%m-%dT%H:%M:%SZ')