Inputting data into a website question

Benjamin Edwards benjumanji at
Wed Apr 22 00:39:06 CEST 2009

On Apr 21, 11:10 pm, grocery_stocker <cdal... at> wrote:
> Let's say that I have a file with the following words
> shirt
> jeans
> belt
> jacket
> Now I want to be able to enter these words into the search function at
> the following website..
> Is there some method in the urllib method that would allow me to do
> this? I tried googling this, but all I found was stuff related to CGI.

Have you considered looking at the urls that you are posting to?

I think the pattern to spot here is not too hard ;)

&submit.x=5&submit.y=5" % {values:here}

submit just seems to be caputuring the click co-ordinated on the
button. There is also some post data being sent to a different url,
but I haven't investigated it yet. In any case it shouldn't be very
difficult to iterate through your search terms and get the http back.

import urllib
fsock = open(myterms.txt)
for lines in fsock:                                       1
    sock = urllib.urlopen("http://url/" % (search,terms,in,line)) 2
    htmlSource =                            3
    sock.close()                                        4
    print htmlSource

or something like that...

More information about the Python-list mailing list