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 Crabtree <[EMAIL PROTECTED]> wrote:

> 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 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 answering :)
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to