473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

urllib2 meta-refresh

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?

Jul 18 '05 #1
3 3584
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
Jul 18 '05 #2
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
Jul 18 '05 #3
JanC <us*********@janc.invalid> 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
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bmiras | last post by:
I've got a problem using urllib2 to get a web page. I'm going through a proxy using user/password authentification and i'm trying to get a page asking for a HTTP authentification. And I'm using...
1
by: Matthew Wilson | last post by:
I am writing a script to check on my router's external IP address. My ISP refreshes my IP very often and I use dyndns for the hostname for my computer. My Netgear mr814 router has a webserver that...
2
by: Richard Shea | last post by:
Hi - I'm writing a script which fetches a page from a web server and takes note of any set-cookies which are served in the headers so that when I next request a page I can send those cookies back...
2
by: John F Dutcher | last post by:
Can anyone comment on why the code shown in the Python error is in some way incorrect...or is there a problem with Python on my hoster's site ?? The highlites don't seem to show here...but line...
5
by: Pascal | last post by:
Hello, I want to acces my OWA (Outlook Web Acces - http Exchange interface) server with urllib2 but, when I try, I've always a 401 http error. Can someone help me (and us)? Thanks. ...
0
by: jacob c. | last post by:
When I request a URL using urllib2, it appears that urllib2 always makes the request using HTTP 1.0, and not HTTP 1.1. I'm trying to use the "If-None-Match"/"ETag" HTTP headers to conserve...
0
by: Gil Tal | last post by:
Hi, I use urllib2 to download a redirected url and I get an exception from the bowels of urllib2. It seems that urllib2 implements some super sophisticated self check and tries to control the...
1
by: Ray Slakinski | last post by:
Hello, I have defined a function to set an opener for urllib2, this opener defines any proxy and http authentication that is required. If the proxy has authencation itself and requests an...
0
by: Ali.Sabil | last post by:
hello all, I just maybe hit a bug in both urllib and urllib2, actually urllib doesn't support proxy authentication, and if you setup the http_proxy env var to...
1
by: Alessandro Fachin | last post by:
I write this simply code that should give me the access to private page with htaccess using a proxy, i don't known because it's wrong... import urllib,urllib2 #input url...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.