Github Git命令从发行号获取请求主体
我想通过git命令,特别是通过gitPython库,从issuenumber获取请求主体、主题和URL。我该怎么做呢?GitPython用于与Github Git命令从发行号获取请求主体,github,github-api,gitpython,Github,Github Api,Gitpython,我想通过git命令,特别是通过gitPython库,从issuenumber获取请求主体、主题和URL。我该怎么做呢?GitPython用于与git相关的对象,而拉取请求与GitHub相关,因此无法用于获取GitHub数据 您可以使用GitHub的v4 GraphQLAPI通过以下查询获取拉取请求的详细信息 query { repository(name: "gitPython",owner:"gitpython-developers"){ pullRequest(number:97
git
相关的对象,而拉取请求与GitHub相关,因此无法用于获取GitHub数据
您可以使用GitHub的v4 GraphQLAPI通过以下查询获取拉取请求的详细信息
query {
repository(name: "gitPython",owner:"gitpython-developers"){
pullRequest(number:974){
body
title
url
}
}
}
上述查询的curl请求:
curl -L -X POST 'https://api.github.com/graphql' \
-H 'Authorization: bearer <token>' \
-H 'Content-Type: text/plain' \
--data-raw '{"query":"{\n repository(name: \"gitPython\",owner:\"gitpython-developers\"){\n pullRequest(number:974){\n body\n title\n url\n }\n }\n }"'
注意:您需要生成一个令牌来访问GraphQL API,您可以按照给定的步骤生成该API
或者,您甚至可以使用下面的GitHub的v3api来获取拉取请求的详细信息,其中包含主体、标题和url字段作为响应的一部分
GET https://api.github.com/repos/{owner}/{repoName}/pulls/{pullRequestNumber}
GET https://api.github.com/repos/gitpython-developers/GitPython/pulls/974
我在终端中安装了github命令行接口,可以从
hubapi获得响应https://api.github.com/repos/{owner}/{repo_name}/issues/{issue_number}
但是从python代码命令子进程。检查输出(cmd,shell=True,bufsize=1,universal_newlines=True)
我有{CalledProcessError}命令“hub api xxxxx”返回非零退出状态2。
有什么想法吗?
GET https://api.github.com/repos/{owner}/{repoName}/pulls/{pullRequestNumber}
GET https://api.github.com/repos/gitpython-developers/GitPython/pulls/974