我正在处理请求和Github python库,基本上是构建一个脚本,在特定条件下更新Github中的webhook(URL)。在
使用下面的代码,我得到了一些信息,比如GitHub组织、GitHub用户和GitHub存储库(只是举几个例子):
**from github import Github
import json
import requests
def function_example():
gh = Github('MY_TOKEN_HERE', base_url='https://MY-GITHUB-DOMAIN/api/v3')
get_users = gh.get_user().name
print("USERNAME: ", get_users)
print(" ")
# user_repos = gh.repos.list().all()
user_repos = gh.get_repos()
print("REPOS: ", user_repos)
print(" ")
orgs = gh.get_organization('MY_GITHUB_ORG_HERE')
print("ORGS: ", orgs)
print(" ")
if __name__ == '__main__':
function_example()
# Eof**
但是,我需要标识webhooks URL(位于Github->;Repo->;Setting->;webhooks)以便用新域更新它们。问题是我还没有找到如何获取或列出特定存储库的所有webhook。在
我一直在阅读一个名为smartsheet的有许可证的库,它看起来像是在使用这个库 我们可以处理网络钩子。。。但我这里没有安装这个库:-(
是否可以使用那些python库(请求和/或Github)列出/标识URL webhook?在
如果是这样,有人能给我举个例子吗?在
我会非常感谢你的!在
何塞
有一个
GetHooks()
调用。见https://developer.github.com/v3/repos/hooks/似乎有一个Github Webhooks API:https://developer.github.com/v3/repos/hooks/#list-hooks
使用请求,您应该能够对每个repo在webhook上执行CRUD操作。在
列出回购挂钩的调用如下所示:
相关问题 更多 >
编程相关推荐