title: Http Error 405/500 in Python/Mechanize (using mechanize auto login one website)
body: <p>Here is the website's address on which i want to using python/mechanize to auto login:</p>
  
  <pre><code>http://www.autohome.com.cn/tools/hometoplogin.html
  </code></pre>
  
  <p>And here is my code:</p>
  
  <pre><code>br = Browser()
  login_url = 'http://www.autohome.com.cn/tools/hometoplogin.html'
  cj = cookielib.LWPCookieJar()
  br.set_cookiejar(cj)
  br.open(login_url)
  br.select_form(nr = 0)
  br['name'] = username
  br['pwd'] = password
  print br.submit().read()
  </code></pre>
  
  <p>However the codes throws Http Error 500:</p>
  
  <pre><code>File "build\bdist.win32\egg\mechanize\_mechanize.py", line 541, in submit
  File "build\bdist.win32\egg\mechanize\_mechanize.py", line 203, in open
  File "build\bdist.win32\egg\mechanize\_mechanize.py", line 255, in _mech_open
  mechanize._response.httperror_seek_wrapper: HTTP Error 500: Internal Server Error
  </code></pre>
  
  <p>sometimes it will throws Http Error 405:</p>
  
  <pre><code>HTTP Error 405: Method Not Allowed
  </code></pre>
  
  <p>Now i am so confused...please help...</p>
  
  <hr>
  
  <p>now i have fixed my python code , shown below</p>
  
  <pre><code>username = 'staryin'
  password = 'zxy1985'
  login_url = 'http://www.autohome.com.cn/tools/hometoplogin.html'
  br = Browser()
  cj = cookielib.LWPCookieJar()
  br.set_cookiejar(cj)
  br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
  br.open(login_url)
  br.select_form(nr = 0)
  br['name'] = username
  br['pwd'] = password
  br.form.action = login_url
  br.submit().read()
  </code></pre>
  
  <p>it also throws http error 405 shown in below</p>
  
  <pre><code>File "build\bdist.win32\egg\mechanize\_mechanize.py", line 541, in submit
  File "build\bdist.win32\egg\mechanize\_mechanize.py", line 203, in open
  File "build\bdist.win32\egg\mechanize\_mechanize.py", line 255, in _mech_open
  mechanize._response.httperror_seek_wrapper: HTTP Error 405: Method Not Allowed
  </code></pre>
  
  <p>who can help me to solve this problem?thanks a lot.</p>