GitHub requires a User-Agent
This commit is contained in:
parent
bd13238d9b
commit
1a44c2117b
@ -239,7 +239,7 @@ class GitHub: # {{{
|
|||||||
files, reponame, version, username, password, replace)
|
files, reponame, version, username, password, replace)
|
||||||
self.current_tag_name = self.version if self.version == 'nightly' else f'v{self.version}'
|
self.current_tag_name = self.version if self.version == 'nightly' else f'v{self.version}'
|
||||||
self.is_nightly = self.current_tag_name == 'nightly'
|
self.is_nightly = self.current_tag_name == 'nightly'
|
||||||
self.auth = 'Basic ' + base64.standard_b64encode((self.username + ':' + self.password).encode()).decode()
|
self.auth = 'Basic ' + base64.standard_b64encode(f'{self.username}:{self.password}'.encode()).decode()
|
||||||
self.url_base = f'{self.API}/repos/{self.username}/{self.reponame}/releases'
|
self.url_base = f'{self.API}/repos/{self.username}/{self.reponame}/releases'
|
||||||
|
|
||||||
def info(self, *args: Any) -> None:
|
def info(self, *args: Any) -> None:
|
||||||
@ -256,6 +256,7 @@ class GitHub: # {{{
|
|||||||
headers={
|
headers={
|
||||||
'Authorization': self.auth,
|
'Authorization': self.auth,
|
||||||
'Accept': 'application/vnd.github+json',
|
'Accept': 'application/vnd.github+json',
|
||||||
|
'User-Agent': 'kitty',
|
||||||
}
|
}
|
||||||
if params:
|
if params:
|
||||||
url += '?' + urlencode(params)
|
url += '?' + urlencode(params)
|
||||||
@ -285,11 +286,11 @@ class GitHub: # {{{
|
|||||||
failure_callback: Callable[[HTTPResponse], None] = lambda r: None,
|
failure_callback: Callable[[HTTPResponse], None] = lambda r: None,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
for i in range(num_tries):
|
for i in range(num_tries):
|
||||||
|
try:
|
||||||
if upload_path:
|
if upload_path:
|
||||||
conn = self.make_request(url, method='POST', upload_data=ReadFileWithProgressReporting(upload_path), params=params)
|
conn = self.make_request(url, method='POST', upload_data=ReadFileWithProgressReporting(upload_path), params=params)
|
||||||
else:
|
else:
|
||||||
conn = self.make_request(url, data, method, params=params)
|
conn = self.make_request(url, data, method, params=params)
|
||||||
try:
|
|
||||||
with contextlib.closing(conn):
|
with contextlib.closing(conn):
|
||||||
r = conn.getresponse()
|
r = conn.getresponse()
|
||||||
if r.status in success_codes:
|
if r.status in success_codes:
|
||||||
@ -407,7 +408,7 @@ class GitHub: # {{{
|
|||||||
if r.status == 200:
|
if r.status == 200:
|
||||||
return {str(k): v for k, v in json.loads(r.read()).items()}
|
return {str(k): v for k, v in json.loads(r.read()).items()}
|
||||||
if self.is_nightly:
|
if self.is_nightly:
|
||||||
raise SystemExit('No existing nightly release found on GitHub')
|
self.fail(r, 'No existing nightly release found on GitHub')
|
||||||
data = {
|
data = {
|
||||||
'tag_name': self.current_tag_name,
|
'tag_name': self.current_tag_name,
|
||||||
'target_commitish': 'master',
|
'target_commitish': 'master',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user