Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
openEuler-Advisor
提交
b20a499b
O
openEuler-Advisor
项目概览
openeuler
/
openEuler-Advisor
通知
41
Star
4
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openEuler-Advisor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b20a499b
编写于
6月 17, 2020
作者:
S
Shinwell Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update gitee.py for compatibility issue
上级
d6f9e946
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
46 addition
and
2 deletion
+46
-2
advisors/gitee.py
advisors/gitee.py
+46
-2
未找到文件。
advisors/gitee.py
浏览文件 @
b20a499b
...
...
@@ -13,6 +13,7 @@ import re
import
os.path
import
json
import
pprint
from
datetime
import
datetime
class
Gitee
(
object
):
...
...
@@ -33,6 +34,7 @@ class Gitee(object):
self
.
advisor_url_template
=
self
.
advisor_url
+
"upstream-info/{package}.yaml"
#self.specfile_exception_url = "https://gitee.com/openeuler/openEuler-Advisor/raw/master/helper/specfile_exceptions.yaml"
self
.
specfile_exception_url
=
self
.
advisor_url
+
"helper/specfile_exceptions.yaml"
self
.
time_format
=
"%Y-%m-%dT%H:%M:%S%z"
def
post_gitee
(
self
,
url
,
values
,
headers
=
None
):
"""
...
...
@@ -96,8 +98,8 @@ Yours openEuler-Advisor.
"""
get and load gitee json response
"""
#
headers = self.headers.copy()
headers
=
{}
headers
=
self
.
headers
.
copy
()
#
headers = {}
headers
[
"Content-Type"
]
=
"application/json;charset=UTF-8"
resp
=
self
.
get_gitee
(
url
,
headers
)
return
json
.
loads
(
resp
)
...
...
@@ -140,6 +142,48 @@ Yours openEuler-Advisor.
return
resp
else
:
return
False
def
get_issues
(
self
,
pkg
,
prj
=
"src-openeuler"
):
"""
List all open issues of pkg
"""
issues_url
=
"https://gitee.com/api/v5/repos/{prj}/{pkg}/issues?"
.
format
(
prj
=
prj
,
pkg
=
pkg
)
#parameters = "access_token={token}&state=open&sort=created&derection=desc&creator=" + self.token["user"]
parameters
=
"state=open&sort=created&direction=desc&page=1&per_page=20"
return
self
.
get_gitee_json
(
issues_url
+
parameters
)
def
get_issue_comments
(
self
,
pkg
,
number
,
prj
=
"src-openeuler"
):
"""
Get comments of specific issue
"""
issues_url
=
"https://gitee.com/api/v5/repos/{prj}/{pkg}/issues?"
.
format
(
prj
=
prj
,
pkg
=
pkg
)
parameters
=
"number={num}&page=1&per_page=20&order=asc"
return
self
.
get_gitee_json
(
issues_url
+
parameters
)
def
post_issue
(
self
,
pkg
,
title
,
body
,
prj
=
"src-openeuler"
):
"""
Post new issue
"""
issues_url
=
"https://gitee.com/api/v5/repos/{prj}/issues"
.
format
(
prj
=
prj
)
parameters
=
{}
parameters
[
"access_token"
]
=
self
.
token
[
"access_token"
]
parameters
[
"repo"
]
=
pkg
parameters
[
"title"
]
=
title
parameters
[
"body"
]
=
body
self
.
post_gitee
(
issues_url
,
parameters
)
def
post_issue_comment
(
self
,
pkg
,
number
,
comment
,
prj
=
"src-openeuler"
):
issues_url
=
"https://gitee.com/api/v5/repos/{prj}/{pkg}/issues/{number}/comments"
.
format
(
prj
=
prj
,
pkg
=
pkg
,
number
=
number
)
parameters
=
{}
parameters
[
"access_token"
]
=
self
.
token
[
"access_token"
]
parameters
[
"body"
]
=
comment
self
.
post_gitee
(
issues_url
,
parameters
)
def
get_gitee_datetime
(
self
,
time_string
):
result
=
datetime
.
strptime
(
time_string
,
self
.
time_format
)
return
result
.
replace
(
tzinfo
=
None
)
if
__name__
==
"__main__"
:
pass
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录