1 Star 0 Fork 1

ydna0/oepkgsbuild_check

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tools.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
ydna0 提交于 2023-11-27 13:21 . add notes
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ydna0/oepkgsbuild_check.git
git@gitee.com:ydna0/oepkgsbuild_check.git
ydna0
oepkgsbuild_check
oepkgsbuild_check
master

搜索帮助