Python program problem involving reading a web site.

Markus von Ehr markus.vonehr at ipm.fhg.de
Mon Jun 3 06:11:10 EDT 2002


You can use win32com to access IE or netscape if you are on
a win32 system.

Look at the testNetcape.py example.

Mike Varney schrieb:

> Hello.
>
> I wrote a quick little program that is supposed to read the html from a web
> site and to update the web counter to show another hit.
> I am able to read the html code fine, but the counter on the web site is not
> updating.
> Here is the code.
>
> Any suggestions?
> Thanks.
>
> import urllib # imports url library
> from time import sleep # imports sleep timer
>
> # Initilize variables
> a = 0
> t = 0
>
> # User Input
> x = input("How many hits do you want to add to counter? ")
> t = input("How long do you want to pause between each hit? (Recommend > 1
> min) ")
>
> # while loop
>
> while a < x:
>  # open and reads page
>  sock = urllib.geturl(http://foo.bar)
>  hampage = sock.read()
>  sock.close()
>  print a
>  sleep(t)
>  a = a+1
> # print goodbye
> print "you have increased the page count by "
> print a
> print "hits"




More information about the Python-list mailing list