urllib2 meta-refresh

A

Artificial Life

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?
 
D

Dave Brueck

Artificial said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top