Created
March 9, 2019 02:32
-
-
Save mtellin/9b5d59ff06b2708fbd792c8f6da85090 to your computer and use it in GitHub Desktop.
Shows getting a list of all VMs using the requests module instead of the Rubrik SDK
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
#!/usr/bin/env python3 | |
rubrik_server = "10.0.11.14" | |
rubrik_user = "admin" | |
rubrik_pass = "password" | |
import requests | |
session = requests.post('https://{}/api/v1/session'.format(rubrik_server), verify = False, auth =(rubrik_user,rubrik_pass)) | |
session_token = session.json() | |
authorization = 'Bearer ' + session_token['token'] | |
vm_list = requests.get('https://{}/api/v1/vmware/vm'.format(rubrik_server), verify = False, headers = {'Content-Type': 'application/json', 'Authorization': authorization}) | |
vm_list_json = vm_list.json() | |
print(vm_list_json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment