urllib2 meta-refresh

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Artificial Life

    #1

    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?

  • Dave Brueck

    #2
    Re: urllib2 meta-refresh

    Artificial Life wrote:[color=blue]
    > 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.[/color]

    Right - urllib2 is for working with protocols (like HTTP) to transfer data,
    whereas META-REFRESH is an application (browser) level "instructio n" *in* that
    data. Compare this to a 302 HTTP response header (a simple redirect) - urllib2
    can handle it because it is part of HTTP.
    [color=blue]
    > Any way around this?[/color]

    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

    Comment

    • JanC

      #3
      Re: urllib2 meta-refresh

      Artificial Life schreef:
      [color=blue]
      > 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?[/color]

      Have a look at the HTTPRefreshProc essor in ClientCookie:
      <http://wwwsearch.sourc eforge.net/ClientCookie/doc.html>

      --
      JanC

      "Be strict when sending and tolerant when receiving."
      RFC 1958 - Architectural Principles of the Internet - section 3.9

      Comment

      • John J. Lee

        #4
        Re: urllib2 meta-refresh

        JanC <usenet_spam@ja nc.invalid> writes:
        [color=blue]
        > Artificial Life schreef:
        >[color=green]
        > > 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?[/color]
        >
        > Have a look at the HTTPRefreshProc essor in ClientCookie:
        > <http://wwwsearch.sourc eforge.net/ClientCookie/doc.html>[/color]

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




        John

        Comment

        Working...