-
Notifications
You must be signed in to change notification settings - Fork 20
/
github_org_teams.py
48 lines (33 loc) · 1.33 KB
/
github_org_teams.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# github_org_teams.py
# Stephen Wong <[email protected]>
# Available subject to the Apache 2.0 License
# https://www.apache.org/licenses/LICENSE-2.0
import argparse
from github_config import *
from github_scanner import *
import requests
def main():
"""
List all the teams in a GitHub organization and information about them
Arguments:
--token XXX = GitHub Personal Access Token (default = defined in github_coinfig.py)
--org XXX = GitHub organization name, e.g. "Rice-COMP-310"
Ref: https://docs.github.com/en/rest/reference/teams#list-teams
"""
parser = argparse.ArgumentParser(description='Invites GitHub users to teams.')
parser.add_argument('--token',
nargs=1,
default=[default_github_token],
help='GitHub API token')
parser.add_argument('--org',
nargs=1,
default=[default_github_organization],
help='GitHub Organization')
args = parser.parse_args()
github_token = args.token[0]
github_org = args.org[0]
endpoint = "orgs/{org}/teams".format(org=github_org)
result = get_github_endpoint(endpoint, github_token)
print("result =", dict_to_pretty_json(result))
if __name__ == "__main__":
main()