Skip to content

Instantly share code, notes, and snippets.

@tomkooij
Last active December 9, 2019 14:52
Show Gist options
  • Save tomkooij/75ad239b1b991b92b03167252dfcbcd2 to your computer and use it in GitHub Desktop.
Save tomkooij/75ad239b1b991b92b03167252dfcbcd2 to your computer and use it in GitHub Desktop.
batch verwijder account van JupyterHub via de rest API
# 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