示例#1
0
文件: xnSpider.py 项目: xm45/xnSpider
	def login(self, user):
		#定义post的参数
		reqdata={'email':user.username,
		'password':user.password,
		'autoLogin':'******',
		'origURL':'http://www.renren.com/home',
		'domain':'renren.com'
		}
		domain = r"http://www.renren.com/ajaxLogin/login?1=1"
		response = self.__session.post(domain, data = reqdata)
		resdict = xnString.j2o(response.text)
		if resdict['code'] == True:
			self.work_msg("\n登陆成功!\n")
			self.work_msg("您的用户ID是: %s \n"%self.__getSelfUid())
			self.work_msg("您的用户名是: %s \n"%self.getNameByUid(self.selfid))
			self.work_msg("您的 cookies: %s \n"%self.getcookies())
			return True
		else:
			self.work_msg("\n登录失败!\n")
			self.work_msg(resdict['failDescription']+'\n')
			return False
示例#2
0
文件: makeLog.py 项目: xm45/xnSpider
def isItem(text,funclist):
	obj = xnString.j2o(text, prerr = False)
	if type(obj) != dict:
		return None
	for attr in enum.attributes:
		if not attr in obj:
			return None
		else:
			if attr == 'action' and not obj[attr] in enum.action:
				print("transform to object error:\n\
						object:%s\n\
						attributes:%s\n\
						actionList:%s\n"%(obj,attr,enum.action))
				return None
			if attr == 'func' and not obj[attr] in funclist:
				print("transform to object error:\n\
						object:%s\n\
						attributes:%s\n\
						funcList:%s\n"%(obj,attr,funclist))
				return None
	return obj
示例#3
0
 def login(self, user):
     #定义post的参数
     reqdata = {
         'email': user.username,
         'password': user.password,
         'autoLogin': '******',
         'origURL': 'http://www.renren.com/home',
         'domain': 'renren.com'
     }
     domain = r"http://www.renren.com/ajaxLogin/login?1=1"
     response = self.__session.post(domain, data=reqdata)
     resdict = xnString.j2o(response.text)
     if resdict['code'] == True:
         self.work_msg("\n登陆成功!\n")
         self.work_msg("您的用户ID是: %s \n" % self.__getSelfUid())
         self.work_msg("您的用户名是: %s \n" % self.getNameByUid(self.selfid))
         self.work_msg("您的 cookies: %s \n" % self.getcookies())
         return True
     else:
         self.work_msg("\n登录失败!\n")
         self.work_msg(resdict['failDescription'] + '\n')
         return False