title: using mechanize to post on wordpress
body: <p>Long story short I need to post automated comments to my WordPress blog. I find mechanize for Python (hurray! no need to muck around in PHP!) but I can't post comments with it. According to the debug info I logged in successfully and returned to the comment page, but comments don't show. What's weirder is that when I try posting the same thing twice, I get the feedback "duplicate comment detected" as if it had already been posted... WTF? Revelant bits of my code:</p>
  
  <pre><code>br = mechanize.Browser()
  
  cj = cookielib.LWPCookieJar()
  br.set_cookiejar(cj)
  
  br.set_debug_redirects(True)
  br.set_debug_responses(True)
  br.set_debug_http(True)
  
  logger = logging.getLogger('mechanize')
  logger.addHandler(logging.StreamHandler(sys.stdout))
  logger.setLevel(logging.INFO)
  
  br.open('some wordpress comment page')
  
  response = br.follow_link(url_regex=r'wp-login')
  
  br.select_form(nr=0)
  br['log'] = username
  br['pwd'] = passwd
  br.submit()
  
  # the above logs me in successfully
  
  br.select_form(nr=1)
  br['comment'] = comment
  
  response = br.submit()
  </code></pre>
  
  <p>...doesn't work. Any ideas?</p>