[Tutor] entering text on web site
Walter Prins
wprins at gmail.com
Wed Jun 13 15:27:23 CEST 2012
Hi,
On 13 June 2012 13:35, Benjamin Fishbein <bfishbein79 at gmail.com> wrote:
> Hello. I have been teaching myself Python and have been stuck on this problem for a week--I scoured the web for an answer and even asked a couple computer programmer friends.
> I managed to write a simple program with urllib that downloads the content from web pages; but I want to put text in a text box on the webpage, have it entered into the website, and then get the results. Is there a way to do this with Python?
Please clarify, are you:
a) Trying to automatically post some text to a web page from Python
and then retrieve the resultant page? (for example, username and
password and retrieve resultant logon page.)
b) Trying to use Python to present a webpage that a user then puts
text in a box which the Python program then captures when the user
submits the page?
I'm assuming a.) If so, then I should ask, does this page use POST or
GET style submission?
In any case, here's a stackeroverflow question regarding using POST
and cookies etc:
http://stackoverflow.com/questions/2954381/python-form-post-using-urllib2-also-question-on-saving-using-cookies
.. with the default Python documentation doing a decent job of explaining GET:
http://docs.python.org/howto/urllib2.html
This also seems useful/relevant:
http://stackoverflow.com/questions/10916745/scraping-data-from-simple-website-change-post-to-get
Walter
More information about the Tutor
mailing list