Last active
December 9, 2019 14:52
-
-
Save tomkooij/75ad239b1b991b92b03167252dfcbcd2 to your computer and use it in GitHub Desktop.
batch verwijder account van JupyterHub via de rest API
This file contains 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
# API docs: https://nh-production-api.jove.surfsara.nl/usermgmtapi/#/ | |
import requests | |
url = 'https://nh-production-api.jove.surfsara.nl/usermgmtapi/v1/jaas-ldap-rest/user/%s' | |
headers = {'X-API-Application': 'jaas-ldap-api', | |
'X-API-Key': 'geheim!!', | |
'Content-Type': 'application/json;charset=utf-8' | |
} | |
# call get service with headers and params | |
for i in range(200, 300): | |
uname = 'wordpress%d' % i | |
print('delete: ', uname) | |
response = requests.delete(url % uname, headers=headers) | |
print(response.status_code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment