def getLoginResponse(self, url = URLLOGIN):
     #clientform doesn't like HTML, and I don't want to monkey patch it, so getUrllib2ResponseObject was born.
     response = getUrllib2ResponseObject(url)
     forms = ParseResponse(response, backwards_compat=False)
     #set username & password in the signin form
     form = forms[1]
     form["users[username]"] = self.username
     form["users[password]"] = self.password
     form["users[rememberme]"] = ['1']
     #click submit
     return getHTML(
 def login(self, username = None, password = None):
     """Try to login using @username and @password.
     Return True if successful, False otherwise"""
     if username and password:
         response = getUrllib2ResponseObject(URLLOGIN)
         forms = ParseResponse(response, backwards_compat=False)
         # Set username & password in the signin form
         form = forms[2]
         form["username"] = username
         form["password"] = password
         # Click submit
         html = getHTML(
         soup = BeautifulSoup(html)
         if soup.title.string == u'Le Forum Arrêt Sur Images':
             # We are on the forum page - login successful
             return True
     return False