Author mnewman
Recipients georg.brandl, mnewman
Date 2010-01-29.01:18:16
SpamBayes Score 1.35262e-10
Marked as misclassified No
Message-id <1264727901.97.0.79188131386.issue7802@psf.upfronthosting.co.za>
In-reply-to
Content
Following the example in Section 20.23.5. ProtocolError Objects of:
http://docs.python.org/3.1/library/xmlrpc.client.html
It implies that an invalid URL will give raise an xmlrpc.client.ProtocolError. Instead I'm getting a socket.gaierror instead. (I also tried using the google address to show tat ProtocolError is working correctly if a real URL is used, but doesn't offer XML-RPC services.) This similarly is happening for xmlrpclib on Python 2.6.

Is this a bug or documentation mistake?

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpc.client
>>> proxy = xmlrpc.client.ServerProxy("http://invalidaddress/")
>>> proxy.some_method()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python31\lib\xmlrpc\client.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "C:\python31\lib\xmlrpc\client.py", line 1271, in __request
    verbose=self.__verbose
  File "C:\python31\lib\xmlrpc\client.py", line 1058, in request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "C:\python31\lib\xmlrpc\client.py", line 1144, in send_request
    connection.request("POST", handler, request_body, headers)
  File "C:\python31\lib\http\client.py", line 918, in request
    self._send_request(method, url, body, headers)
  File "C:\python31\lib\http\client.py", line 956, in _send_request
    self.endheaders(body)
  File "C:\python31\lib\http\client.py", line 914, in endheaders
    self._send_output(message_body)
  File "C:\python31\lib\http\client.py", line 768, in _send_output
    self.send(msg)
  File "C:\python31\lib\http\client.py", line 716, in send
    self.connect()
  File "C:\python31\lib\http\client.py", line 698, in connect
    self.timeout)
  File "C:\python31\lib\socket.py", line 292, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed
>>> proxy = xmlrpc.client.ServerProxy("http://www.google.com/")
>>> proxy.some_method()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python31\lib\xmlrpc\client.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "C:\python31\lib\xmlrpc\client.py", line 1271, in __request
    verbose=self.__verbose
  File "C:\python31\lib\xmlrpc\client.py", line 1065, in request
    dict(resp.getheaders())
xmlrpc.client.ProtocolError: <ProtocolError for www.google.com/: 405 Method Not Allowed>
>>>

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> proxy = xmlrpclib.ServerProxy("http://invalidaddress/")
>>> proxy.some_method()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python26\lib\xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "C:\python26\lib\xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "C:\python26\lib\xmlrpclib.py", line 1235, in request
    self.send_content(h, request_body)
  File "C:\python26\lib\xmlrpclib.py", line 1349, in send_content
    connection.endheaders()
  File "C:\python26\lib\httplib.py", line 892, in endheaders
    self._send_output()
  File "C:\python26\lib\httplib.py", line 764, in _send_output
    self.send(msg)
  File "C:\python26\lib\httplib.py", line 723, in send
    self.connect()
  File "C:\python26\lib\httplib.py", line 704, in connect
    self.timeout)
  File "C:\python26\lib\socket.py", line 500, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed
>>> proxy = xmlrpclib.ServerProxy("http://www.google.com/")
>>> proxy.some_method()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python26\lib\xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "C:\python26\lib\xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "C:\python26\lib\xmlrpclib.py", line 1243, in request
    headers
xmlrpclib.ProtocolError: <ProtocolError for www.google.com/: 405 Method Not Allowed>

I also checked Python 3.1 on Linux:

Python 3.1.1 (r311:74480, Oct 18 2009, 19:21:53) [GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpc.client
>>> proxy = xmlrpc.client.ServerProxy("http://invalidaddress/")
>>> proxy.some_method()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1271, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1058, in request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1144, in send_request
    connection.request("POST", handler, request_body, headers)
  File "/usr/local/lib/python3.1/http/client.py", line 918, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/lib/python3.1/http/client.py", line 956, in _send_request
    self.endheaders(body)
  File "/usr/local/lib/python3.1/http/client.py", line 914, in endheaders
    self._send_output(message_body)
  File "/usr/local/lib/python3.1/http/client.py", line 768, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.1/http/client.py", line 716, in send
    self.connect()
  File "/usr/local/lib/python3.1/http/client.py", line 698, in connect
    self.timeout)
  File "/usr/local/lib/python3.1/socket.py", line 292, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known
>>> proxy = xmlrpc.client.ServerProxy("http://www.google.com/")
>>> proxy.some_method()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1271, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python3.1/xmlrpc/client.py", line 1065, in request
    dict(resp.getheaders())
xmlrpc.client.ProtocolError: <ProtocolError for www.google.com/: 405 Method Not Allowed>
History
Date User Action Args
2010-01-29 01:18:22mnewmansetrecipients: + mnewman, georg.brandl
2010-01-29 01:18:21mnewmansetmessageid: <1264727901.97.0.79188131386.issue7802@psf.upfronthosting.co.za>
2010-01-29 01:18:20mnewmanlinkissue7802 messages
2010-01-29 01:18:17mnewmancreate