-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdb-2.py
More file actions
46 lines (41 loc) · 926 Bytes
/
cmdb-2.py
File metadata and controls
46 lines (41 loc) · 926 Bytes
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
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf8 -*-
import json
import requests
msg = {
"host": {
"bk_supplier_account": "0"
},
"data": {
"meta": {
"model": {
"bk_classification_id": "middelware",
"bk_obj_id": "test1",
"bk_obj_name": "test1n",
"bk_supplier_account": "0"
},
"fields": {
"bk_inst_name": {
"bk_property_name": "实例名",
"bk_property_type": "longchar"
},
"field1": {
"bk_property_name": "field1",
"bk_property_type": "longchar"
}
}
},
"data": {
"bk_inst_key": "test1",
"field1": "field 1",
"bk_inst_name": "inst1"
}
}
}
data = {
"name": "middleware",
"mesg": json.dumps(msg)
}
host = "http://172.16.228.114:12140"
url = "http://127.0.0.1:12140"
response = requests.request("POST", host, data=json.dumps(data))
print(response.status_code, response.text)