-
Notifications
You must be signed in to change notification settings - Fork 1
/
global_test.py
36 lines (31 loc) · 871 Bytes
/
global_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import fuctional_replication
import secrets
import json
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
username = secrets.username
password = secrets.password
category_name = "DG_test"
value = "GroupA"
headers = {'content-type': 'application/json'}
PCIP = secrets.PCIP
def fetch_category_entity():
url = f"https://{PCIP}:9440/api/nutanix/v3/category/query"
payload = {
"usage_type": "APPLIED_TO",
"category_filter": {
"kind_list": [
"vm"
],
"type": "CATEGORIES_MATCH_ANY",
"params": {
category_name: [
value
]
}}}
resp = requests.post(url, verify=False, auth=(username,password), headers=headers, json=payload)
print(resp.status_code)
pretty_json = json.dumps(resp.json(), indent=4)
print(pretty_json)
fetch_category_entity()