classification
Title: Allow to set headers in xmlrpc.client.ServerProxy
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ced, matrixise, vstinner
Priority: normal Keywords: patch

Created on 2018-11-03 11:26 by ced, last changed 2019-02-19 16:19 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10308 merged python-dev, 2018-11-03 11:32
Messages (7)
msg329191 - (view) Author: Cédric Krier (ced) * Date: 2018-11-03 11:26
If we want to support other authentication method than basic, we need to be able to set headers to the request sent.
I propose to add an argument headers to ServerProxy which is a list of header tuples that will be put as header.
msg329192 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2018-11-03 11:40
Do you have an example where we need to have extra headers?

but +1 for the feature, I marked this issue for 3.8
msg329194 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2018-11-03 12:01
and could you add some tests for this new feature?

Thank you.
msg329196 - (view) Author: Cédric Krier (ced) * Date: 2018-11-03 12:57
We have a library proteus which uses xmlrpc.client to connect to our server. The server support basic authentication but also session authentication. The session authentication is much faster because the password hash verification is slow by design.
So to be able to use our session authentication method with the library, we need to be able to set our own Authorization header to the ServerProxy. It could be done with a custom Transport class but then we will have to do it twice for Transport and SafeTransport and to replicate the code that select the class out of the uri.
The proposal started from this discussion: https://bugs.tryton.org/issue7783
msg329197 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2018-11-03 13:23
ok +1 for me and I understand the need.

But there is no defined experts for the xmlrpc part. We have to wait for a review just for the feature.
msg335780 - (view) Author: Cédric Krier (ced) * Date: 2019-02-17 16:47
I have another use case to be able to set headers to xmlrpc: http://www.roundup-tracker.org/docs/xmlrpc.html#advanced-python-client-adding-anti-csrf-headers
msg335965 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-02-19 16:18
New changeset beda52ed36e701e45f22903fc4d3bec0d085b25b by Victor Stinner (Cédric Krier) in branch 'master':
bpo-35153: Add headers parameter to xmlrpc.client.ServerProxy (GH-10308)
https://github.com/python/cpython/commit/beda52ed36e701e45f22903fc4d3bec0d085b25b
History
Date User Action Args
2019-02-19 16:19:33vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-02-19 16:18:55vstinnersetnosy: + vstinner
messages: + msg335965
2019-02-17 16:47:45cedsetmessages: + msg335780
2018-11-03 13:23:57matrixisesetmessages: + msg329197
2018-11-03 12:57:09cedsetmessages: + msg329196
2018-11-03 12:01:45matrixisesetmessages: + msg329194
2018-11-03 11:40:11matrixisesetnosy: + matrixise

messages: + msg329192
versions: + Python 3.8
2018-11-03 11:32:49python-devsetkeywords: + patch
stage: patch review
pull_requests: + pull_request9615
2018-11-03 11:26:11cedcreate