Created
          June 9, 2020 10:46 
        
      - 
      
- 
        Save johnddias/ed61a72883281627296d8ef38811a2bc to your computer and use it in GitHub Desktop. 
    Get vROps Auth Token
  
        
  
    
      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
    
  
  
    
  | 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