I see, my mistake was (tacitly) assuming that encode() could work in place.
Now I see that it should work in a previous line as you wrote.
Thank you!
/H.
On 2020-11-02 18:32, Karsten Hilbert wrote:
On Mon, Nov 02, 2020 at 06:21:15PM +0100, Hernán De Angelis wrote:
For the record:
Just reply to myself and whoever might find this useful.
encode() must be done within the request call:
Nope (but it can, as you showed).
header = {'Content-type':'application/xml', 'charset':'UTF-8'}
response = requests.post(server, data=request.encode('utf-8'),
headers=header)
not in a previous separate line as I did.
Your separate line was wrong as much as ayone can guess:
I have tried of course adding
request.encode('utf-8')
before sending the request but it has not lead to a different result.
You would have needed to do:
request = request.encode('utf-8')
because .encode() does not operate in-place.
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
--
https://mail.python.org/mailman/listinfo/python-list