Skip to content

Instantly share code, notes, and snippets.

@grantorchard
Created October 23, 2017 11:40
Show Gist options
  • Save grantorchard/20a51fc23138d38e9f818fd81158446b to your computer and use it in GitHub Desktop.
Save grantorchard/20a51fc23138d38e9f818fd81158446b to your computer and use it in GitHub Desktop.
baseurl with default value
@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