2019-11-11 17:48:20 +00:00
|
|
|
import requests
|
|
|
|
import pyotp
|
|
|
|
import json
|
|
|
|
import decouple
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
arg_parser = argparse.ArgumentParser()
|
2019-11-11 17:59:10 +00:00
|
|
|
arg_parser.add_argument("admin_seed")
|
2019-11-11 17:48:20 +00:00
|
|
|
args = arg_parser.parse_args()
|
|
|
|
|
|
|
|
r = requests.post("http://localhost:{}/create".format(decouple.config("PORT")),
|
|
|
|
json={
|
|
|
|
"name": "auth",
|
|
|
|
"realm": ["ungleich-auth"],
|
|
|
|
"admin_name": "admin",
|
|
|
|
"admin_realm": "ungleich-admin",
|
|
|
|
"admin_token": pyotp.TOTP(args.admin_seed).now()
|
|
|
|
})
|
|
|
|
print(json.loads(r.content.decode("utf-8")))
|