-
Notifications
You must be signed in to change notification settings - Fork 1
/
posts.py
55 lines (44 loc) · 938 Bytes
/
posts.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
37
38
39
40
41
42
43
44
45
46
47
48
#coding: utf-8
import requests
import json
test_date = [
{
'test1': {
'user': 'lisetn',
'job': 'te',
'mac': 'aa:bb:cc:dd:ee:ff',
'ip': '192.168.1.1',
'description': '',
}
},
{
'test2': {
'user': 'test',
'job': 'cn',
'mac': 'aa:11:cc:33:ee:55',
'ip': '192.168.100.100',
'description': '',
}
},
{
'test3': {
'user': 'test1',
'job': 'cn1',
'mac': 'aa:11:cc:33:ee:55',
'ip': '192.168.100.100',
'description': '1',
},
'test4': {
'user': 'test4',
'job': 'cn',
'mac': 'aa:11:cc:33:ee:55',
'ip': '192.168.100.100',
'description': '4',
}
}
]
#json encode
json_str = json.dumps(test_date)
data = json_str.encode('utf-8')
r = requests.post("http:https://127.0.0.1:5000/", data={'data': data})
print r.text