[Distutils] PyPI XMLRPC interface no longer works with Python 2.6

M.-A. Lemburg mal at egenix.com
Tue Jul 8 17:13:22 CEST 2014


On 08.07.2014 17:09, Donald Stufft wrote:
> You’re using http:// rather than https:// yea?

Yes. xmlrpclib in Python 2.6 doesn't understand HTTPS. Support for
it was added in Python 2.7.

> On Jul 8, 2014, at 10:49 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> 
>> I opened an issue for this:
>> https://bitbucket.org/pypa/pypi/issue/157/pypi-xmlrpc-interface-no-longer-works-with
>>
>> On 08.07.2014 16:32, M.-A. Lemburg wrote:
>>> 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.
>>>
>>> Thanks,
>>>
>>
>> -- 
>> Marc-Andre Lemburg
>> eGenix.com
>>
>> Professional Python Services directly from the Source  (#1, Jul 08 2014)
>>>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
>> ________________________________________________________________________
>> 2014-07-21: EuroPython 2014, Berlin, Germany ...           13 days to go
>>
>> ::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
>>
>>   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>>    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>>           Registered at Amtsgericht Duesseldorf: HRB 46611
>>               http://www.egenix.com/company/contact/
>> _______________________________________________
>> Distutils-SIG maillist  -  Distutils-SIG at python.org
>> https://mail.python.org/mailman/listinfo/distutils-sig
> 
> 
> -----------------
> Donald Stufft
> PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
> 

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jul 08 2014)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2014-07-21: EuroPython 2014, Berlin, Germany ...           13 days to go

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Distutils-SIG mailing list