-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMethod.py
More file actions
21 lines (18 loc) · 774 Bytes
/
Method.py
File metadata and controls
21 lines (18 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import urllib.request
import re
class method:
def get_hiddenvalue(url):
request = urllib.request.Request(url)
reponse= urllib.request.urlopen(request)
# try:
# reponse = urllib.request.urlopen(request)
# except urllib.error.HTTPError as e:
# print(e.code)
# print(e.reason)
resu = reponse.read()
resu =resu.decode('utf-8')
VIEWSTATE = re.findall(r'<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*)" />', resu,re.I)
EVENTVALIDATION = re.findall(r'<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*)" />', resu,re.I)
print(VIEWSTATE)
print(EVENTVALIDATION)
return VIEWSTATE[0], EVENTVALIDATION[0]