urllib redirect

sp00fD sp00fD at yahoo.com
Tue Apr 18 11:43:35 CEST 2000


You haven't really given a description of your problem, but I'll go
ahead and take a stab anyway...maybe you need another newline character
like so 'print "Content-type: text/html\n"'.  Otherwise, I think what
you have should work, although I haven't played with urllib too much
(just enough to verify that what you're doing will print out a web-
page).  Here's a tip, anytime you're having trouble, take it to the
interactive python prompt and try it there.

In article <4.1.20000418125557.030592d0 at 202.95.1.37>,
  Thomas <thomas at madeforchina.com> wrote:
> I've got a pretty tame question.
>
> I want one of my functions to redirect the URL.
> (ie I call the script and off I go to www.spam.com)
>
> So, here's what I get, and have not overcome yet:
>
> import urllib
> def simpleredirect() :
>     ############
>      print "Content-type: text/html"
>      print urllib.urlopen('http://www.spam.com').read()
>
> simpleredirect()
>
> TIA,
> Tom
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list