XML RPC changes between 3.7 and 3.9 yield 401 http error

lucas lucas at bourneuf.net
Wed Feb 24 09:29:58 EST 2021


Hi everyone,

(Sorry for the double-send if any, i'm not sure the first send was 
performed, maybe because of bounce errors according to mailman.)


I'm currently trying to understand an error when using the 
dokuwikixmlrpc python module, allowing to easily work with DokuWiki RPC 
interface.

Another description of the problem :
	https://github.com/kynan/dokuwikixmlrpc/issues/8

Here is the code, tailored to work with the DokuWiki RPC interface:

     from urllib.parse import urlencode
     import xmlrpc.client as xmlrpclib

     URL = 'wiki.example.net'
     USER = 'user'
     PASSWD = 'password'
     USER_AGENT = 'DokuWikiXMLRPC  1.0  for testing'

     script = '/lib/exe/xmlrpc.php'
     url = URL + script + '?' + urlencode({'u': USER, 'p': PASSWD})
     xmlrpclib.Transport.user_agent = USER_AGENT
     xmlrpclib.SafeTransport.user_agent = USER_AGENT
     proxy = xmlrpclib.ServerProxy(url)

     v = proxy.dokuwiki.getVersion()
     print(v)

When ran with Python 3.7 (a personnal debian server, or a personal 
windows computer), i obtain the expected 'Release 2018-04-22a "Greebo"' 
as ouput.
When ran with Python 3.9 (my personnal, manjaro machine), i obtain the 
following stacktrace:

     Traceback (most recent call last):
       File "/home/project/read.py", line 32, in <module>
         v = proxy.dokuwiki.getVersion()
       File "/usr/lib/python3.9/xmlrpc/client.py", line 1116, in __call__
         return self.__send(self.__name, args)
       File "/usr/lib/python3.9/xmlrpc/client.py", line 1456, in __request
         response = self.__transport.request(
       File "/usr/lib/python3.9/xmlrpc/client.py", line 1160, in request
         return self.single_request(host, handler, request_body, verbose)
       File "/usr/lib/python3.9/xmlrpc/client.py", line 1190, in 
single_request
         raise ProtocolError(
     xmlrpc.client.ProtocolError: <ProtocolError for 
wiki.example.net/lib/exe/xmlrpc.php: 401 Unauthorized>

I don't have the possibility to test this on python 3.8 specifically, 
but since the XML and XMLRPC modules have been updated in 3.8, and since 
3.9 doesn't seems to introduce any change for them, i would expect 3.8 
to introduce some change that dokuwikixmlrpc has somehow to take into 
consideration.

Can anyone help me with that one ? I don't know anything about RPC and 
XML, i don't know what i need to do know to fix dokuwikixmlrpc.

Best regard,
--lucas


More information about the Python-list mailing list