Created
October 23, 2017 11:40
-
-
Save grantorchard/20a51fc23138d38e9f818fd81158446b to your computer and use it in GitHub Desktop.
baseurl with default value
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
@classmethod | |
def login(self, key, baseurl='https://console-stg.cloud.vmware.com/csp/gateway'): | |
uri = '/am/api/auth/login/accounts/access-keys' | |
headers = {'Content-Type':'application/json'} | |
payload = json.dumps({'key': key}) | |
r = requests.post(f'{baseurl}{uri}', headers = headers, data = payload) | |
auth_header = r.json()['cspAuthToken'] | |
p = r.json() | |
return self(key, auth_header, baseurl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment