Created
March 28, 2017 14:50
-
-
Save sverhoeven/7ead30daacf23334e209354579e771ac to your computer and use it in GitHub Desktop.
List webhooks of all repos in a GitHub organization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github3.py==1.0.0a4 | |
click==6.7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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