I have requested one question relating to this last month, it's here: http://stackoverflow.com/questions/3362399/post-method-to-communicate-directly-with-a-server.
And That I still did not get exactly why sometimes I recieve 404 error and often everything works fine, I am talking about I have attempted individuals codes with a number of different wordpress blogs. Using opera or IE, you are able to publish the comment with no problem whatever wordpress blog it's, but using python and "publish" method directly interacting having a server I acquired 404 with several blogs. And I have attempted to spoof the headers, adding snacks within the code, however the result continues to be same. It's annoying me for a long time... Anybody knows the main reason? Or what code must i increase result in the program works as being a browser for example opera or IE etc ? Hopefully everyone would assist me!
You need to use somthing like mechanize.
Anyway, should you wanna simulate a genuine browser, the easiest way is by using a genuine browser rc by python.
Take a look at WebDriver (http://seleniumhq.org/paperwork/09_webdriver.html) It features a python implementation and may run HtmlUnit, chrome, IE and Opera browsers.