-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv14.py
More file actions
27 lines (22 loc) · 676 Bytes
/
Copy pathv14.py
File metadata and controls
27 lines (22 loc) · 676 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
from urllib import request, parse
from http import cookiejar
cookie = cookiejar.CookieJar()
cookie_handler = request.HTTPCookieProcessor(cookie)
http_handler = request.HTTPHandler()
https_handler = request.HTTPSHandler()
opener = request.build_opener(http_handler, https_handler, cookie_handler)
def login():
url = "http://www.renren.com/PLogin.do"
data = {
"email": "18022308503",
"password": "123456Qw"
}
data = parse.urlencode(data).encode()
req = request.Request(url, data=data)
rsp = opener.open(req)
if __name__ == '__main__':
login()
print(type(cookie))
print(cookie)
for item in cookie:
print(item)