Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save johnddias/ed61a72883281627296d8ef38811a2bc to your computer and use it in GitHub Desktop.
Save johnddias/ed61a72883281627296d8ef38811a2bc to your computer and use it in GitHub Desktop.
Get vROps Auth Token
import requests
import json
def getAuthToken(context, inputs):
if "verify" not in inputs.keys():
inputs["verify"] = True
headers = {'Content-type':'application/json','Accept':'application/json'}
payload = {
'username':inputs["username"],
'authSource':inputs["authSource"],
'password':inputs["password"]
}
r = requests.request('POST','https://'+inputs["vropsHost"]+'/suite-api/api/auth/token/acquire', data=json.dumps(payload), headers=headers, verify=inputs["verify"])
token = json.loads(r.text)
return(token["token"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment