代码拉取完成,页面将自动刷新
import requests
def get_requests(method, url, body=None, timeout=30, obj=None):
"""
http request
:param method: http method
:param url: http[s] schema
:param body: json
:param timeout: second
:param obj: callback object, support list/dict/object
:return:
"""
get_function = getattr(requests, method.lower())
result = get_function(url, json=body, timeout=timeout)
result_list = [requests.codes.ok, requests.codes.created, requests.codes.no_content]
if result.status_code not in result_list:
return 2
if obj is not None:
if isinstance(obj, dict):
obj.update(result.json())
return 0
def get_branch(gitbranch):
"""
get build branch
:param gitbranch: the branch of the repo
:return:
the build branch,which version of openeuler
"""
branch=''
if gitbranch=='master':
branch='20.03-LTS-SP1'
else:
branch=gitbranch[10:]
return branch
#t1=get_branch('openEuler-20.03-LTS-SP3')
#print(t1)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。