Skip to content
Snippets Groups Projects
Commit 707a1388 authored by Sven Warris's avatar Sven Warris
Browse files

Python scripts to connect to PHIS

parent 35ca7dd1
Branches
No related tags found
No related merge requests found
#!/usr/bin/python3
import requests
import hashlib
import json
import configparser
import sys
config = configparser.ConfigParser()
config.read(sys.argv[1])
userInfo = {
"grant_type": "password",
"username": config["USER"]["username"],
"password": hashlib.md5(config["USER"]["password"].encode('utf-8')).hexdigest(),
"client_id": "string"
}
connection = requests.post(config["webservice"]["url"]+config["BRAPI"]["token"],
data=json.dumps(userInfo),
headers=json.loads(config["BRAPI"]["headers"]))
authentication = connection.json()
print(authentication["access_token"])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment