-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.py
40 lines (33 loc) · 861 Bytes
/
template.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
import requests
import json
from pprint import pprint
requests.packages.urllib3.disable_warnings()
USERNAME = "admin"
PASSWORD = "1234QWer"
URL = "https://192.168.10.1/"
# 1. Authentication
payload = {
'aaaUser': {
'attributes': {
'name': USERNAME,
'pwd': PASSWORD
}
}
}
auth = requests.post(f'{URL}api/aaaLogin.json', data=json.dumps(payload), verify=False)
COOKIES = auth.cookies
# 2. task
payload_task = {
'' : {
'attributes': {
'dn': f'',
'name':,
'rn': f'',
'status':,
},
'children': []
}
}
result = requests.post(f'{URL}api/node/mo/uni/infra/lacpifp-{PO_MEMBER_PROFILE_FAST}.json', data=json.dumps(payload_task), verify = False, cookies=COOKIES)
print('Return code: {code}'.format(code=result.status_code))
pprint(result.content)