Skip to content

Instantly share code, notes, and snippets.

@davidhuser
Created March 29, 2018 17:55
Show Gist options
  • Save davidhuser/95bb72593337d8c145cc9243140fe65a to your computer and use it in GitHub Desktop.
Save davidhuser/95bb72593337d8c145cc9243140fe65a to your computer and use it in GitHub Desktop.
DHIS2 events deletion
import requests
events = [
"xmqrawVQZez",
"I7yG1WFoZxF"
]
url = "https://play.dhis2.org/2.28"
username = "admin"
password = "district"
s = requests.Session()
for i, uid in enumerate(events,1):
r = s.delete("{}/api/events/{}".format(url, uid), auth=(username, password))
r.raise_for_status()
print("[{}/{}] Event {} deleted".format(i, len(events), uid))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment