mirror of
				https://github.com/balkian/jupyterhub-oauth.git
				synced 2025-11-04 00:28:17 +00:00 
			
		
		
		
	Added download_users script
This commit is contained in:
		
							
								
								
									
										32
									
								
								download_users.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								download_users.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
from github import GitHub
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import json
 | 
			
		||||
 | 
			
		||||
ACCESS_TOKEN = os.environ.get("GH_ACCESS_TOKEN", None)
 | 
			
		||||
ORG = os.environ.get("GH_ORG", "gsi-upm")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
gh = GitHub(access_token=ACCESS_TOKEN)
 | 
			
		||||
 | 
			
		||||
users = []
 | 
			
		||||
 | 
			
		||||
tfilter = sys.argv[1:]
 | 
			
		||||
allteams = gh.orgs(ORG).teams.get()
 | 
			
		||||
print(list(t["name"] for t in allteams))
 | 
			
		||||
tlist = list(t for t in allteams if t["name"] in tfilter)
 | 
			
		||||
print(tlist)
 | 
			
		||||
 | 
			
		||||
for t in tlist:
 | 
			
		||||
    print("Getting team: %s" % t["name"])
 | 
			
		||||
    t["members"] = gh.teams(t["id"]).members.get()
 | 
			
		||||
    for m in t["members"]:
 | 
			
		||||
        login = m["login"]
 | 
			
		||||
        users.append(login)
 | 
			
		||||
 | 
			
		||||
with open("userlist", "w") as f:
 | 
			
		||||
    for user in set(users):
 | 
			
		||||
        f.write(user)
 | 
			
		||||
        if user in ("oaraque", "balkian", "cif2cif"):
 | 
			
		||||
            f.write(" admin")
 | 
			
		||||
        f.write("\n")
 | 
			
		||||
							
								
								
									
										51
									
								
								userlist
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								userlist
									
									
									
									
									
								
							@@ -1,36 +1,21 @@
 | 
			
		||||
balkian admin
 | 
			
		||||
cif2cif admin
 | 
			
		||||
nachtkatze admin
 | 
			
		||||
adri87
 | 
			
		||||
AlbertoED
 | 
			
		||||
alejandroSaura
 | 
			
		||||
allopezf
 | 
			
		||||
alvarocarrera
 | 
			
		||||
amardomingo
 | 
			
		||||
antoniom-diaz
 | 
			
		||||
arturomtm
 | 
			
		||||
Batlin
 | 
			
		||||
carloscrespog
 | 
			
		||||
constanr
 | 
			
		||||
DanielLara
 | 
			
		||||
dmorenob
 | 
			
		||||
jochoaserna
 | 
			
		||||
SergioML9
 | 
			
		||||
emilioserra
 | 
			
		||||
enriquecs
 | 
			
		||||
gpoveda
 | 
			
		||||
gsi-bot
 | 
			
		||||
hopple
 | 
			
		||||
javiherrera
 | 
			
		||||
JesusMSM
 | 
			
		||||
Krun
 | 
			
		||||
ladvan
 | 
			
		||||
miguelcb84
 | 
			
		||||
mtorresl
 | 
			
		||||
oaraque admin
 | 
			
		||||
Drozzer
 | 
			
		||||
constanr
 | 
			
		||||
antoniom-diaz
 | 
			
		||||
Lorena25
 | 
			
		||||
NachoCP
 | 
			
		||||
neburdv
 | 
			
		||||
neoner2002
 | 
			
		||||
pmoncadaisla
 | 
			
		||||
RBermejo
 | 
			
		||||
rmaestre
 | 
			
		||||
rongil
 | 
			
		||||
rodbarest
 | 
			
		||||
alvarocarrera
 | 
			
		||||
gpoveda
 | 
			
		||||
hopple
 | 
			
		||||
AlbertoED
 | 
			
		||||
sunshengjing
 | 
			
		||||
toniprada
 | 
			
		||||
balkian admin
 | 
			
		||||
pepos
 | 
			
		||||
antoniofll
 | 
			
		||||
enriquecs
 | 
			
		||||
miguelcb84
 | 
			
		||||
JesusMSM
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user