8000 Remove dependency on GitHub provided URLs · pythonthings/github3.py@a4cd241 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4cd241

Browse files
committed
Remove dependency on GitHub provided URLs
1 parent 3c698a3 commit a4cd241

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

github3/repos/release.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,10 @@ def archive(self, format, path=''):
7373
7474
"""
7575
resp = None
76-
if format == 'tarball':
77-
resp = self._get(self.tarball_url, allow_redirects=True,
78-
stream=True)
79-
80-
elif format == 'zipball':
81-
resp = self._get(self.zipball_url, allow_redirects=True,
82-
stream=True)
76+
if format in ('tarball', 'zipball'):
77+
repo_url = self._api[:self._api.rfind('/releases')]
78+
url = self._build_url(format, self.tag_name, base_url=repo_url)
79+
resp = self._get(url, allow_redirects=True, stream=True)
8380

8481
if resp and self._boolean(resp, 200, 404):
8582
utils.stream_response_to_file(resp, path)

0 commit comments

Comments
 (0)
0