@@ -19,7 +19,7 @@ PATH = Path.home() / '.local/state/kg-hifox-release'
|
||||
RUN_ID = re.compile('[1-9][0-9]{0,14}')
|
||||
|
||||
|
||||
def forge(method, path, payload=None):
|
||||
def forge(method, path, payload=None, *, raw=False):
|
||||
request = Request(cd.FORGE + path, method=method,
|
||||
data=json.dumps(payload).encode() if payload is not None else None)
|
||||
env = {**os.environ, 'GIT_TERMINAL_PROMPT': '0', 'GIT_ASKPASS': '/bin/false'}
|
||||
@@ -31,7 +31,7 @@ def forge(method, path, payload=None):
|
||||
request.add_header('Authorization', 'Basic ' + auth)
|
||||
request.add_header('Content-Type', 'application/json')
|
||||
with build_opener(ProxyHandler({}), cd.NoRedirect()).open(request, timeout=20) as response:
|
||||
return json.load(response)
|
||||
return response.read(2**20 + 1) if raw else json.load(response)
|
||||
|
||||
|
||||
def hifox(cli, *args):
|
||||
|
||||
Reference in New Issue
Block a user