如何在 gitlab api 问题查询中使用 `not` 条件
How to use `not` condition in the gitlab api issue query
我正在尝试阅读没有标签 已解决 的未决问题列表。为此,我指的是 API 文档 (https://docs.gitlab.com/ee/api/issues.html),其中提到了 NOT 但我无法让 NOT 起作用。
以下 python 脚本到目前为止我已经尝试阅读问题列表,但现在我无法找到如何使用 NOT 来过滤尚未 解决的问题 标签。
import gitlab
# private token or personal token authentication
gl = gitlab.Gitlab('https://example.com', private_token='XXXYYYZZZ')
# make an API request to create the gl.user object. This is mandatory if you
# use the username/password authentication.
gl.auth()
# list all the issues
issues = gl.issues.list(all=True,scope='all',state='opened',assignee_username='username')
for issue in issues:
print(issue.title)
来自Gitlab issues api documentation, not
is of type Hash
. It's a special type documented here
例如,要排除标签 Category:DAST
和 devops::secure
,并排除里程碑 13.11
,您可以使用以下参数:
not[labels]=Category:DAST,devops::secure
not[milestone]=13.11
使用 gitlab python 模块,您需要通过添加更多关键字参数来传递一些额外的参数:
import gitlab
gl = gitlab.Gitlab('https://gitlab.com')
extra_params = {
'not[labels]': "Category:DAST,devops::secure",
"not[milestone]": "13.11"
}
issues = gl.issues.list(all=True, scope='all', state='opened',
assignee_username='derekferguson', **extra_params)
for issue in issues:
print(issue.title)
我正在尝试阅读没有标签 已解决 的未决问题列表。为此,我指的是 API 文档 (https://docs.gitlab.com/ee/api/issues.html),其中提到了 NOT 但我无法让 NOT 起作用。
以下 python 脚本到目前为止我已经尝试阅读问题列表,但现在我无法找到如何使用 NOT 来过滤尚未 解决的问题 标签。
import gitlab
# private token or personal token authentication
gl = gitlab.Gitlab('https://example.com', private_token='XXXYYYZZZ')
# make an API request to create the gl.user object. This is mandatory if you
# use the username/password authentication.
gl.auth()
# list all the issues
issues = gl.issues.list(all=True,scope='all',state='opened',assignee_username='username')
for issue in issues:
print(issue.title)
来自Gitlab issues api documentation, not
is of type Hash
. It's a special type documented here
例如,要排除标签 Category:DAST
和 devops::secure
,并排除里程碑 13.11
,您可以使用以下参数:
not[labels]=Category:DAST,devops::secure
not[milestone]=13.11
使用 gitlab python 模块,您需要通过添加更多关键字参数来传递一些额外的参数:
import gitlab
gl = gitlab.Gitlab('https://gitlab.com')
extra_params = {
'not[labels]': "Category:DAST,devops::secure",
"not[milestone]": "13.11"
}
issues = gl.issues.list(all=True, scope='all', state='opened',
assignee_username='derekferguson', **extra_params)
for issue in issues:
print(issue.title)