Skip to content

Commit

Permalink
add _login method in RenrenDiannzan
Browse files Browse the repository at this point in the history
  • Loading branch information
atupal committed Jun 22, 2013
1 parent 959b780 commit 63f240c
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions dianzan/renren_dianzan.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
# -*- coding=utf-8 -*-

import requests
import json

class RenrenDianzan():
def __init__(self):
pass
'''
self.s: the Session of the object
'''
def __init__(self, user = None, pwd = None, debug = False):
self.user = user if user else "atupal@foxmail.com"
self.pwd = pwd if pwd else "LKYs4690102"
self.s = requests.Session()
self.debug = debug
self._login()

def _login(self):
pass
self.login_data = {
'email': self.user,
'password': self.pwd,
'autoLogin': "true",
'icode': '',
'origURL': 'http://www.renren.com/home',
'domain': 'renren.com',
'key_id': '1',
'captcha_type': 'web_login',
}
res = self.s.post('http://renren.com/ajaxLogin/login?1=1&uniqueTimestamp=201350118726', data = self.login_data)
if self.debug:
print res.content
res_json = json.loads(res.content)

url = res_json['homeUrl'] #回调url
res = self.s.get(url)
if self.debug:
print res.content


if __name__ == "__main__":
R = RenrenDianzan(debug = True)

0 comments on commit 63f240c

Please sign in to comment.