XML RPC changes between 3.7 and 3.9 yield 401 http error
2QdxY4RzWzUUiLuE at potatochowder.com
2QdxY4RzWzUUiLuE at potatochowder.com
Wed Feb 24 10:20:00 EST 2021
On 2021-02-24 at 15:29:58 +0100,
lucas <lucas at bourneuf.net> wrote:
> 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>
At the risk of stating the obvious, it might actually be an
authentication problem. In addition to double checking the password:
(1) make sure all of your certificates (under Arch Linux, on which
Manjaro is based), that's the ca-certificates package) are up to date;
and
(2) check with whoever owns the wiki about any other certificates they
require.
After that, all I know about XML RPC is to avoid it. :-)
> 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.
More information about the Python-list
mailing list