Op 14-06-12 04:44, Benjamin Fishbein schreef:
Thanks. I'm trying to automatically post text to a web page from Python and retrieve the resultant page. It's not just name and password, though; I need to do it over and over again with chunks of info from a list.
The page seems to be using POST.
form method='POST'
is written all throughout the code.
The links you recommended use modules like Client Cookie, mechanize, etc. I guess Python didn't come standard with a module that could do what I wanted...
Which is the best module to get for this?
I had successful results with the mechanize package in the past.

Timo


Ben


On Jun 13, 2012, at 8:27 AM, Walter Prins wrote:

Hi,

On 13 June 2012 13:35, Benjamin Fishbein <bfishbei...@gmail.com <mailto:bfishbei...@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
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to