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>
This commit is contained in:
parent
0efd0308a0
commit
6e3c2d757a
1 changed files with 2 additions and 2 deletions
|
@ -305,7 +305,7 @@ class DownloadMethodGitHubTarball(DownloadMethod):
|
||||||
def _init_commit_ts(self):
|
def _init_commit_ts(self):
|
||||||
if self.commit_ts is not None:
|
if self.commit_ts is not None:
|
||||||
return
|
return
|
||||||
url = self._make_repo_url_path('commits', self.version)
|
url = self._make_repo_url_path('git', 'commits', self.version)
|
||||||
ct = self.commit_ts_cache.get(url)
|
ct = self.commit_ts_cache.get(url)
|
||||||
if ct is not None:
|
if ct is not None:
|
||||||
self.commit_ts = ct
|
self.commit_ts = ct
|
||||||
|
@ -313,7 +313,7 @@ class DownloadMethodGitHubTarball(DownloadMethod):
|
||||||
resp = self._make_request(url)
|
resp = self._make_request(url)
|
||||||
data = resp.read()
|
data = resp.read()
|
||||||
data = json.loads(data)
|
data = json.loads(data)
|
||||||
date = data['commit']['committer']['date']
|
date = data['committer']['date']
|
||||||
date = datetime.datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ')
|
date = datetime.datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ')
|
||||||
date = date.timetuple()
|
date = date.timetuple()
|
||||||
ct = calendar.timegm(date)
|
ct = calendar.timegm(date)
|
||||||
|
|
Loading…
Reference in a new issue