コード例 #1
0
	def login(self):
		form = self.soup.form
		action = form['action']
		params = util.makePostData(form)
		data = urllib.urlencode(params)
		html = self.http.post(action, data, {'Content-Type': 'application/x-www-form-urlencoded'});
		util.check_login_error(html)
		return html		
コード例 #2
0
 def login(self, username, password):
     if not self.isLoginPage():
         raise util.NavStateException("not a login page")
     action, data = self.createPost(username, password)
     html = self.http.post(action, data, {'Content-Type': 'application/x-www-form-urlencoded'});
     newPage = LoginPage(None, html)
     if newPage.isLoginPage():
         raise util.LoginException("Library login failed")
     util.check_login_error(html)
     return html
コード例 #3
0
ファイル: opac.py プロジェクト: bluestemscott/librarygadget
 def login(self, username, password):
     if not self.isLoginPage():
         raise util.NavStateException("not a login page")
     action, data = self.createPost(username, password)
     #print data
     html = self.http.post(action, data, {'Content-Type': 'application/x-www-form-urlencoded'})
     #don't check this for opac... some libraries (eg, Kirkendall) embed hidden login forms on the account page
     #newPage = LoginPage(self.http, html)
     #if newPage.isLoginPage():
     #	logging.debug("found another login page after login attempt")
     #	raise util.LoginException("Library login failed")
     util.check_login_error(html)
     return html
コード例 #4
0
 def login(self, username, password):
     idinput = self.soup.find("input", {"name": "sec1"})
     form = idinput.findPrevious("form")
     action = form["action"]
     params = util.makePostData(form)
     # Fill the visible fields
     params["sec1"] = username
     params["sec2"] = password
     data = util.urlencode(params)
     logging.debug(data)
     html = self.http.post(action, data, {"Content-Type": "application/x-www-form-urlencoded"})
     util.check_login_error(html)
     logging.debug(html)
     return html