-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_api.py
41 lines (31 loc) · 1.07 KB
/
test_api.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
import api
import json
import requests
session = requests.Session()
url = "http://192.168.0.1/login.asp"
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8',
"Origin": "http://192.168.0.1",
"Referer" : "http://192.168.0.1/login.asp",
"Sec-GPC" : '1',
"Connection": "keep-alive",
"Content-Length" :"34",
"Cache-Control": "max-age=0",
"Content-Type": "application/x-www-form-urlencoded",
"Upgrade-Insecure-Requests": "1",
"User-Agent": 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36'
}
headers = {"content-type":"text/plain",
"pragma":"no-cache"}
payload = {'Username':'admin', "Password": "YWRtaW4="}
r = requests.post(url, data = payload)
# print(r.content)
print(r.cookies.items())
with open("index.asp", "wb") as f:
f.write(r.content)
# resp = api.getAllStatsJson()
# print(resp)
# with open("./reference/getAllStats.json", 'w') as f:
# json.dump(resp, f)