Following our previous discussion:
    https://www.talkend.net/post/287193.html

I finally took time (thanks to Florian R.) to get a reproducible example of my problem, as asked previously by ChrisA.

The following code is implementing a webserver with Flask, and a client with the XMLRPC client:

    import sys
    from xmlrpc import server, client
    from urllib.parse import urlencode
    from flask import Flask, request


    PORT = 23456
    USER, PASSWD = 'user', 'password'
    URL = '127.0.0.1:' + str(PORT)

    if len(sys.argv) > 1 and sys.argv[1] == 'server':
        app = Flask(__name__)
        @app.route('/', methods=['POST'])
        @app.route('/RPC2', methods=['POST'])
        def login():
            print('REQUEST:', request.args)
            return 'ok'
        app.run(debug=True, host='localhost', port=PORT)

    else:
        url = 'http://' + URL + '?' + urlencode({'u': USER, 'p': PASSWD})
        print(url)
        proxy = client.ServerProxy(url)
        print(proxy, dir(proxy))
        print(proxy.add(2, 3))


You can run the client with `python3 p.py`, and the server with `python3 p.py server`.

On debian, Python 3.7, i got:

    lucas@debianserver:~$ python3.7 p.py server
     * Serving Flask app "p" (lazy loading)
     * Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
       Use a production WSGI server instead.
     * Debug mode: on
     * Running on http://localhost:23456/ (Press CTRL+C to quit)
     * Restarting with stat
     * Debugger is active!
     * Debugger PIN: 249-992-288
127.0.0.1 - - [27/Mar/2021 18:31:13] "POST /?u=user&p=password HTTP/1.1" 404 -


On Arch, python 3.9, i got:

     aluriak@arch❯ python3.9 p.py server
     * Serving Flask app "p" (lazy loading)
     * Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
       Use a production WSGI server instead.
     * Debug mode: on
     * Running on http://localhost:23456/ (Press CTRL+C to quit)
     * Restarting with stat
     * Debugger is active!
     * Debugger PIN: 821-276-100
    127.0.0.1 - - [27/Mar/2021 18:35:45] "POST /RPC2 HTTP/1.1" 200 -


Both systems return the same output on command `pip3 freeze | grep Flask`, which is `Flask==1.1.2`.


Note that the two outputs differs in two ways:

127.0.0.1 - - [27/Mar/2021 18:31:13] "POST /?u=user&p=password HTTP/1.1" 404 -
    127.0.0.1 - - [27/Mar/2021 18:35:45] "POST /RPC2 HTTP/1.1" 200 -

The first contains the arguments, and the second contains the path. Sounds like there is something wrong with both modules.

This should be a reproducible example ; plus i'm not the only one to encounter that problem:
    https://github.com/kynan/dokuwikixmlrpc/issues/8#issuecomment-808755244

Best regards,
--lucas
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to