Last active
May 1, 2021 18:55
-
-
Save kuharan/251ee2d4afccde204a24239c6cd1a7e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| DP_BASE_URL = 'https://xxxx.com:xxxx/' | |
| def dp_login(): | |
| session = requests.session() | |
| url = DP_BASE_URL + 'auth/realms/DataProtector/protocol/openid-connect/token' | |
| payload = {'username':'xxxx|*|xxxx', 'password':'xxxx.', 'client_id':'dp-gui', 'grant_type':'password'} | |
| response = json.loads(session.post(url,data=payload,verify='xxxx_cacert.pem').text) | |
| access_token = response['access_token'] | |
| return access_token, session | |
| #call this using | |
| access_token, session=dp_login() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment