本文整理汇总了Python中login.Login.getCookie方法的典型用法代码示例。如果您正苦于以下问题:Python Login.getCookie方法的具体用法?Python Login.getCookie怎么用?Python Login.getCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类login.Login
的用法示例。
在下文中一共展示了Login.getCookie方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LoginDialog
# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import getCookie [as 别名]
class LoginDialog(Ui_LoginDialog):
def __init__(self,parent=None):
super(LoginDialog,self).__init__(parent)
self.lo = Login()
self.lo.getCookie()
self.readloadCode()
self.login.clicked.connect(self.loginFun)
self.j_codeLabel.clicked.connect(self.readloadCode)
self.j_codeLabel.resize(121,41)
def readloadCode(self):
self.tem_getCAPTCHA = thread_getCAPTCHA(self.lo, self.lo.jid)
self.tem_getCAPTCHA.signal.connect(self.refresh)
self.tem_getCAPTCHA.start()
def refresh(self):
self.tem_getCAPTCHA.quit()
self.j_codeLabel.setPixmap(QtGui.QPixmap('./image/code.jpg'))
self.toggleCheckBox()
self.login.setText(_translate("LoginDialog", u"登录", None))
self.checkbox.setDisabled(False)
def loginFun(self):
username = self.userNameEdit.text().toUtf8()
password = self.passwordEdit.text().toUtf8()
j_code = self.j_codeEdit.text().toUtf8()
self.tem_post = thread_post(username, password, j_code, self.lo)
self.tem_post.signal.connect(self.checkLogin)
self.tem_post.start()
self.login.setDisabled(True)
self.checkbox.setDisabled(True)
self.login.setText(_translate("LoginDialog", u"登录中...", None))
def checkLogin(self,arg):
self.tem_post.quit()
self.lo.sid = arg[0]
arg[1]
if(self.lo.sid != ''):
print 'login seccessed! sid:',self.lo.sid
self.accept()
else:
print arg[1]
QtGui.QMessageBox.critical(self, 'Error', _translate("LoginDialog", arg[1], None))
self.readloadCode()
self.j_codeEdit.clear()
示例2: checkPage
# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import getCookie [as 别名]
'Referer' : ('http://uems.sysu.edu.cn/elect/s/type?%s' % self.sid),\
'Cookie' : self.jid,\
'Connection' : 'keep-alive',\
}
return url,header
def checkPage(self,LessonId,response):
soup = BeautifulSoup(response.read(),"html.parser")
lessons = soup.find(id='elected').find_all('a')
for item in lessons:
if item.has_attr('jxbh') and item['jxbh'] == LessonId:
print u'抢课成功!已选的课程:'
self.printLessons(lessons)
return True
return False
if __name__ == '__main__':
lo = Login()
j_code = lo.getCAPTCHA(lo.getCookie())
Image.open('./image/code.jpg').show()
j_code = raw_input(r"输入看到的验证码:")
username = raw_input('username:')
password = raw_input('password:')
print lo.getSid(username, password, j_code)
subm = SummitReq(lo)
LessonIds = ['35000192151001','35000123151002','35000192151003'\
,'35000192151023','35000152151003','35000190151003']
subm.submit(LessonIds)