[New-bugs-announce] [issue16109] urllib2.urlopen throws HTTP Error in python 2.7.2, 2.7.3, but not in python 2.7

Christian Fertig report at bugs.python.org
Tue Oct 2 17:15:08 CEST 2012


New submission from Christian Fertig:

wespe:/tmp/python2.7 # cat /etc/SuSE-release
openSUSE 12.1 (x86_64)
VERSION = 12.1
CODENAME = Asparagus
wespe:/tmp/python2.7 # rpm -q python
python-2.7.2-7.17.1.x86_64


wespe:/tmp/python2.7 # python
Python 2.7.2 (default, Aug 19 2011, 20:41:43) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2; print urllib2.urlopen('https://172.23.6.222/') # not working
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "urllib2.py", line 397, in open
    response = meth(req, response)
  File "urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 405: Method Not Allowed

>>> import urllib; print urllib.urlopen('https://172.23.6.222/') # working
<addinfourl at 10613608 whose fp = <socket._fileobject object at 0x7f7c20a41d50>>


Other machine:

hornisse:/usr/lib64 # cat /etc/SuSE-release
openSUSE 11.4 (x86_64)
VERSION = 11.4
CODENAME = Celadon
hornisse:/usr/lib64 # rpm -q python
python-2.7-9.40.1.x86_64

hornisse:/usr/lib64 # python
Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2; print urllib2.urlopen('https://172.23.6.222/') # working
<addinfourl at 7832424 whose fp = <socket._fileobject object at 0x756a50>>
>>> import urllib; print urllib.urlopen('https://172.23.6.222/') # working
<addinfourl at 10130856 whose fp = <socket._fileobject object at 0x756850>>



Sometimes the HTTP Error is a 400 Bad Request, but 99% of the time a 405. I've testet openSuSE 12.2 with python 2.7.3 too, not working.

I don't know, what to provide more on information, please contact me, if you need more.

----------
messages: 171811
nosy: fertig
priority: normal
severity: normal
status: open
title: urllib2.urlopen throws HTTP Error in python 2.7.2, 2.7.3, but not in python 2.7
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16109>
_______________________________________


More information about the New-bugs-announce mailing list