-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv15.py
More file actions
25 lines (20 loc) · 694 Bytes
/
Copy pathv15.py
File metadata and controls
25 lines (20 loc) · 694 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
from urllib import request, parse
from http import cookiejar
filename = "renren_cookie.txt"
cookie = cookiejar.MozillaCookieJar(filename)
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)
cookie.save(ignore_discard=True, ignore_expires=True)
if __name__ == '__main__':
login()