urllib2 meta-refresh

Discussion in 'Python' started by Artificial Life, Feb 26, 2005.

  1. 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?
     
    Artificial Life, Feb 26, 2005
    #1
    1. Advertising

  2. Artificial Life

    Dave Brueck Guest

    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
     
    Dave Brueck, Feb 26, 2005
    #2
    1. Advertising

  3. Artificial Life

    JanC Guest

    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
     
    JanC, Mar 3, 2005
    #3
  4. Artificial Life

    John J. Lee Guest

    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
     
    John J. Lee, Mar 4, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nym Pseudo

    META NAME and META HTTP-EQUIV

    Nym Pseudo, Sep 26, 2003, in forum: HTML
    Replies:
    1
    Views:
    601
    =?iso-8859-1?Q?brucie?=
    Sep 26, 2003
  2. Josef Cihal
    Replies:
    0
    Views:
    873
    Josef Cihal
    Sep 5, 2005
  3. Duane Johnson

    Meta methods to govern meta data?

    Duane Johnson, Oct 25, 2005, in forum: Ruby
    Replies:
    6
    Views:
    271
    Adam Sanderson
    Oct 28, 2005
  4. Erik Veenstra

    Meta-Meta-Programming

    Erik Veenstra, Feb 7, 2006, in forum: Ruby
    Replies:
    29
    Views:
    442
    Erik Veenstra
    Feb 8, 2006
  5. Erik Veenstra

    Meta-Meta-Programming, revisited

    Erik Veenstra, Jul 21, 2006, in forum: Ruby
    Replies:
    21
    Views:
    484
    Erik Veenstra
    Jul 25, 2006
Loading...

Share This Page