Re: [Tutor] confusing HTTP error while using urlopen

2008-07-18 Thread arsyed
It looks like the site wants an Accept header. The following works: import urllib2 url = 'http://www.anuntul.ro/' headers = {'Accept': 'text/html'} req = urllib2.Request(url=url, headers=headers) rsp = urllib2.urlopen(req) page = rsp.read() print page On Fri, Jul 18, 2008 at 5:38 PM, Chad Cra

Re: [Tutor] confusing HTTP error while using urlopen

2008-07-18 Thread Chad Crabtree
Well I can confirm this behavior. I tried changing the user-agent thinking there might be some filtering based on that but no go. Still HTTP 400 error. WGET works just fine though On Fri, Jul 18, 2008 at 4:31 PM, asdg asdg <[EMAIL PROTECTED]> wrote: > I'll skip the introduction and go right to t

[Tutor] confusing HTTP error while using urlopen

2008-07-18 Thread asdg asdg
I'll skip the introduction and go right to the question cause it's as simple as it's confusing for me. Why does urllib2.urlopen("http://www.anuntul.ro";) return HTTPError: HTTP Error 400: Bad Request, while the site opens with no problems in any regular browser. Thank you in advance for answeri