Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > urllib2 meta-refresh

Reply
Thread Tools

urllib2 meta-refresh

 
 
Artificial Life
Guest
Posts: n/a
 
      02-26-2005
urllib2 does not seem to be able to handle META-REFRESH in an html
document. I just get back the html to the page that is supposed to forward
me to the intended page. Any way around this?

 
Reply With Quote
 
 
 
 
Dave Brueck
Guest
Posts: n/a
 
      02-26-2005
Artificial Life wrote:
> urllib2 does not seem to be able to handle META-REFRESH in an html
> document. I just get back the html to the page that is supposed to forward
> me to the intended page.


Right - urllib2 is for working with protocols (like HTTP) to transfer data,
whereas META-REFRESH is an application (browser) level "instruction" *in* that
data. Compare this to a 302 HTTP response header (a simple redirect) - urllib2
can handle it because it is part of HTTP.

> Any way around this?


Sure - META-REFRESH is an instruction to the browser, so have your code be the
browser: scan the HTML for the tag, extract the URL, and send that new URL off
to urllib2.

-Dave
 
Reply With Quote
 
 
 
 
JanC
Guest
Posts: n/a
 
      03-03-2005
Artificial Life schreef:

> urllib2 does not seem to be able to handle META-REFRESH in an html
> document. I just get back the html to the page that is supposed to
> forward me to the intended page. Any way around this?


Have a look at the HTTPRefreshProcessor in ClientCookie:
<http://wwwsearch.sourceforge.net/ClientCookie/doc.html>

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
 
Reply With Quote
 
John J. Lee
Guest
Posts: n/a
 
      03-04-2005
JanC <> writes:

> Artificial Life schreef:
>
> > urllib2 does not seem to be able to handle META-REFRESH in an html
> > document. I just get back the html to the page that is supposed to
> > forward me to the intended page. Any way around this?

>
> Have a look at the HTTPRefreshProcessor in ClientCookie:
> <http://wwwsearch.sourceforge.net/ClientCookie/doc.html>


Be sure to read all the notes under "Notes about ClientCookie, urllib2
and cookielib" on this page:

http://wwwsearch.sourceforge.net/ClientCookie/


John
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with: urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) Josef Cihal Python 0 09-05-2005 11:26 AM
FTP with urllib2 behind a proxy O. Koch Python 4 08-14-2003 11:54 AM
urllib2 Clarence Gardner Python 1 08-08-2003 12:34 AM
Re: urllib2 http status John J. Lee Python 1 07-31-2003 09:35 AM
urllib2 for HTTPS/SSL Kylotan Python 5 07-09-2003 02:22 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57