Skip to content

Commit 6e3c2d7

Browse files
committed
scripts/download.py: use a more terse api for fetching git commit date
The previous api [1] includes in its response patch data among other things, as such the response size can vary and be big. Use another api[2] to improve it a bit [1] Get a single commit, Repositories, https://developer.github.com/v3/repos/commits/#get-a-single-commit [2] Git Commits, Git Data, https://developer.github.com/v3/git/commits/#get-a-commit Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
1 parent 0efd030 commit 6e3c2d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/download.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,15 @@ def _init_owner_repo(self):
305305
def _init_commit_ts(self):
306306
if self.commit_ts is not None:
307307
return
308-
url = self._make_repo_url_path('commits', self.version)
308+
url = self._make_repo_url_path('git', 'commits', self.version)
309309
ct = self.commit_ts_cache.get(url)
310310
if ct is not None:
311311
self.commit_ts = ct
312312
return
313313
resp = self._make_request(url)
314314
data = resp.read()
315315
data = json.loads(data)
316-
date = data['commit']['committer']['date']
316+
date = data['committer']['date']
317317
date = datetime.datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ')
318318
date = date.timetuple()
319319
ct = calendar.timegm(date)

0 commit comments

Comments
 (0)