Benutzer-Werkzeuge

Webseiten-Werkzeuge


dapnetapideletenondsgvo

Just for documentation:

#!/usr/bin/python
import MySQLdb
import requests
from requests.auth import HTTPBasicAuth
import time
import sys

login = 'username'
passwd = 'password'
url = 'http://dapnet.db0sda.ampr.org:8080/users'

db = MySQLdb.connect(host="localhost",
                     user="username",
                     passwd="password",
                     db="dapnet")

cur = db.cursor()

cur.execute("SELECT name FROM dapnet.users where dsgvo_accepted='0'")

for row in cur.fetchall():
    name = row[0]

    print 'Deleting: ' + name
    newurl = url + '/' + name

    try:
        response = requests.delete(newurl, auth=HTTPBasicAuth(login, passwd))
        response.raise_for_status()
    except requests.exceptions.RequestException as e:
        print e
#        sys.exit(1)

db.close()

dapnetapideletenondsgvo.txt · Zuletzt geändert: 2018/07/24 20:47 von dh3wr