Skip to content

Instantly share code, notes, and snippets.

@kuharan
Created July 11, 2021 12:07
Show Gist options
  • Save kuharan/937618daf36edee40a694ea7627a1ae8 to your computer and use it in GitHub Desktop.
Save kuharan/937618daf36edee40a694ea7627a1ae8 to your computer and use it in GitHub Desktop.
login to data protector
def login():
session = requests.session()
url = 'https://xxxx.com:7116/auth/realms/DataProtector/protocol/openid-connect/token'
payload = {'username':'username|*|xxxx.com', 'password':'password.', 'client_id':'dp-gui', 'grant_type':'password'}
response = json.loads(session.post(url, data=payload,verify='xxxx.com_cacert.pem').text)
access_token = response['access_token']
return access_token, session
access_token, session=login()
# use the ca certificate found in the server to authenticate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment