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

Donald Stufft donald at stufft.io
Tue Jul 8 17:18:18 CEST 2014


Oh Good. I thought I was going crazy there for a minute :) I’m pretty sure
it happens because of the redirect from HTTP to HTTPS.

On Jul 8, 2014, at 11:17 AM, M.-A. Lemburg <mal at egenix.com> wrote:

> On 08.07.2014 17:15, Donald Stufft wrote:
>> Uh what? HTTPS works fine on my copy of 2.6? If I recall this problem
>> only happens if you use http:// on 2.6.
> 
> Ah, sorry. You're right. I had looked at a diff of the module
> between 2.6 and 2.7 and saw lots of HTTPS related changes.
> 
> With https:// it does work in 2.6 as well.
> 
> Thanks. I'll close the bug report a fix the wiki page.
> 
>> On Jul 8, 2014, at 11:13 AM, M.-A. Lemburg <mal at egenix.com> wrote:
>> 
>>> 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/
>> 
>> 
>> -----------------
>> 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/


-----------------
Donald Stufft
PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20140708/e376c949/attachment-0001.sig>


More information about the Distutils-SIG mailing list