Skip to content

Instantly share code, notes, and snippets.

@kuharan
Last active May 1, 2021 18:55
Show Gist options
  • Select an option

  • Save kuharan/251ee2d4afccde204a24239c6cd1a7e1 to your computer and use it in GitHub Desktop.

Select an option

Save kuharan/251ee2d4afccde204a24239c6cd1a7e1 to your computer and use it in GitHub Desktop.
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