title: How can I login and print the next page? Python, mechanize
body: <p>I'm trying to make a twitter login script in Python, but got stuck on one thing: how can I verify if I logged in? Because it's not clear whether it works or not.  </p>
  
  <pre><code>import mechanize
  br = mechanize.Browser()
  br.set_handle_robots(False)
  br.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36')]
  url = 'http://www.twitter.com/login'
  
  def login(User, Pass):
      global url, br
      br.open(url)
      br.select_form(nr=2)
      br.form["session[username_or_email]"] = User
      br.form["session[password]"] = Pass
      br.submit()
  
      if br.title() == "Twitter": #doesn't work. can't scan the final page
          return True
      else:
          return False
      print br.title()
  User = raw_input("User: ")
  Pass = raw_input("Pass: ")
  </code></pre>
  
  <p><strong>The question is: How can I scan the final page after the script executed and get HTML code of it??</strong></p>