Skip to content

Instantly share code, notes, and snippets.

@sverhoeven
Created March 28, 2017 14:50
Show Gist options
  • Save sverhoeven/7ead30daacf23334e209354579e771ac to your computer and use it in GitHub Desktop.
Save sverhoeven/7ead30daacf23334e209354579e771ac to your computer and use it in GitHub Desktop.
List webhooks of all repos in a GitHub organization
github3.py==1.0.0a4
click==6.7
import click
from github3 import login
@click.command()
@click.option('--loginname')
@click.option('--token', prompt=True, hide_input=True, confirmation_prompt=True, envvar='GITHUB_TOKEN')
@click.option('--organization')
def main(loginname, token, organization):
gh = login(loginname, token=token)
for repository in gh.repositories_by(organization):
for hook in repository.hooks():
if hook.active:
print('|'.join((repository.name,
hook.name,
hook.config.get('url', ''),
)))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment