Parsing data from URL

could ildg could.net at gmail.com
Sun Apr 24 21:50:00 EDT 2005


I think it depends on the server

On 24 Apr 2005 17:24:18 -0700, Harlin Seritt <harlinseritt at yahoo.com> wrote:
> I am trying to do the following:
> 
> <of course website.com is not the actual site>
> 
> import urllib
> 
> url = 'http://www.website.com/file.shtml'
> dat = urllib.urlopen(url, 'r').read()
> print dat
> 
> When I do so, I get the following data:
> 
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <HTML><HEAD>
> <TITLE>405 Method Not Allowed</TITLE>
> </HEAD><BODY>
> <H1>Method Not Allowed</H1>
> The requested method POST is not allowed for the URL <P>
> <HR>
> <ADDRESS>Apache/1.3.27 Server at website.com Port 80</ADDRESS>
> </BODY></HTML>
> 
> How can I make sure that I get the actual html data instead of the data
> from redirected URL?
> 
> thanks,
> 
> Harlin
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list