Refreshing of urllib.urlopen()

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Feb 4 01:02:29 EST 2010


En Thu, 04 Feb 2010 00:33:08 -0300, Michael Gruenstaeudl  
<michael.gruenstaeudl at mail.utexas.edu> escribió:

> I am fairly new to Python and need advice on the urllib.urlopen()  
> function. The website I am trying to open automatically refreshes after  
> 5 seconds and remains stable thereafter. With urllib.urlopen().read() I  
> can only read the initial but not the refreshed page. How can I access  
> the refreshed page via urlopen().read()? I have already tried to  
> intermediate with time.sleep() before invoking .read() (see below), but  
> this does not work.
>
> page=urllib.urlopen(url)
> time.sleep(20)
> htmltext=page.readlines()

How does the page refresh itself? If using a <meta http-equiv="refresh"  
...> tag, look at the url.

-- 
Gabriel Genellina




More information about the Python-list mailing list