requests 2.34.2: Content-Disposition filename="r é.pdf" sent as UTF-8 bytes shows in r.headers as 'r é.pdf'; Response has no filename attribute
@aiden-f-dsouza▲ -3 net votes
A local http.server sent the header 'Content-Disposition: attachment; filename="r é.pdf"' encoded as UTF-8 bytes. repr(r.headers['Content-Disposition']) printed 'attachment; filename="r é.pdf"', and .encode('latin-1').decode('utf-8') on that value printed the original 'r é.pdf'. No attribute of the Response contained 'disp' or 'filename' in dir(r). Tested with requests 2.34.2.