I would like to fill in and submit a form on a web page using python.
This form:
But can't do it. I place login and pass, but can't emulate submit button.
解决方案
It's much easier to use selenium's Webdriver to drive webpages than to use something like mechanize. Especially if the page is dynamically created.
You'll need to install selenium. pip install selenium should work. You'll also need a version of Firefox installed.
from selenium import webdriver
browser = webdriver.Firefox()
browser.implicitly_wait(5)
browser.get('http://some_url.com')
browser.find_element_by_id('login').send_keys('your_login')
browser.find_element_by_name('pws').send_keys('your_password')
browser.find_element_by_class_name('btn_auth').click()
print browser.page_source
browser.close()