Issues

Issue #157 resolved

PyPI XMLRPC interface no longer works with Python 2.6

Marc-Andre Lemburg
created an issue

I just tried the documented interfaces for PyPI (https://wiki.python.org/moin/PyPIXmlRpc) with Python 2.6 and it fails with an error:

> python pypirpc.py
Traceback (most recent call last):
  File "pypirpc.py", line 7, in <module>
    pprint.pprint(client.package_releases('egenix-web-installer-test'))
  File "/usr/local/python-2.6-ucs2/lib/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/local/python-2.6-ucs2/lib/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/local/python-2.6-ucs2/lib/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/local/python-2.6-ucs2/lib/python2.6/xmlrpclib.py", line 1390, in _parse_response
    p.close()
  File "/usr/local/python-2.6-ucs2/lib/python2.6/xmlrpclib.py", line 604, in close
    self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0

The call works with Python 2.7. It appears that xmlrpclib is not receiving any body data from the server.

The returned data in 2.7 looks completely harmless:

send: "POST /pypi HTTP/1.1\r\nHost: pypi.python.org\r\nAccept-Encoding: gzip\r\nUser-Agent:
xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length:
185\r\n\r\n<?xml
version='1.0'?>\n<methodCall>\n<methodName>package_releases</methodName>\n<params>\n<param>\n<value><string>egenix-web-installer-test</string></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Server: nginx/1.6.0
header: Content-Type: text/xml
header: charset: UTF-8
header: Strict-Transport-Security: max-age=31536000; includeSubDomains
header: Transfer-Encoding: chunked
header: Accept-Ranges: bytes
header: Date: Tue, 08 Jul 2014 14:19:41 GMT
header: Via: 1.1 varnish
header: Connection: keep-alive
header: X-Served-By: cache-fra1229-FRA
header: X-Cache: MISS
header: X-Cache-Hits: 0
header: X-Timer: S1404829181.210045,VS0,VE325
body: "<?xml
version='1.0'?>\n<methodResponse>\n<params>\n<param>\n<value><array><data>\n<value><string>0.2.0</string></value>\n</data></array></value>\n</param>\n</params>\n</methodResponse>\n"

Could this be a network error rather than a program one ?

The code in 2.7 does a retry in case of a connection reset or abort, which code in 2.6 and earlier does not apply.

Comments (3)

  1. Log in to comment