Created
July 11, 2021 12:07
-
-
Save kuharan/937618daf36edee40a694ea7627a1ae8 to your computer and use it in GitHub Desktop.
login to data protector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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