python-requests post with unicode filenames
I've read through several related questions here on SO but didn't manage to find a working solution.
I have a Flask server with this simplified code:
app = Flask(__name__)api = Api(app)class SendMailAPI(Resource): def post(self): print request.files return Response(status=200)api.add_resource(SendMailAPI, '/')if __name__ == '__main__': app.run(host='0.0.0.0', debug=True)
Then in the client:
# coding:utf-8import requestseng_file_name = 'a.txt'heb_file_name = u'א.txt'requests.post('http://localhost:5000/', files={'file0': open(eng_file_name, 'rb')})requests.post('http://localhost:5000/', files={'file0': open(heb_file_name, 'rb')})
When sending the first request with the non-utf-8 filename the server receives the request with the file and prints ImmutableMultiDict([('file0', <FileStorage: u'a.txt' (None)>)]), but when sending the file with the utf-8 filename the server doesn't seem to receive the file as it prints ImmutableMultiDict([]).
I'm using requests 2.3.0 but the problem doesn't resolve with the latest version as well (2.8.1), Flask version is 0.10.1 and Flask-RESTful version is 0.3.4.
I've done some digging in requests code and the request seems to be sent ok (ie with the file), and I printed the request right before it is being sent and see the file name was indeed encoded to RFC2231:
--6ea257530b254861b71626f10a801726Content-Disposition: form-data; name="file0"; filename*=utf-8''%D7%90.txt
To sum things up, I'm not entirely sure if the problem lies within requests that doesn't properly attach the file to the request or if Flask is having issues with picking up files with file names that are encoded according to RFC2231.
UPDATE: Came across this issue in requests GitHub: https://github.com/kennethreitz/requests/issues/2505
https://codehunter.cc/a/flask/python-requests-post-with-unicode-filenames
0 notes
Lavender by resident @arochatattoo . . . . . #safespace #sacredart #lgtbqi #sacredarttattoos #sacredartlondon #dalston #stokey #london #londontattoo #tattoo #tattooart #queerart #queer #qttr #qbmc #pics_of_inked_ #ttt #tttism #txttoing #ink #ldnttt #dsrupttt #tttism #fusionink #equilattera #skinart (at London, United Kingdom) https://www.instagram.com/p/B3Ox400FfqM/?igshid=100bjc3tqh21s
57 notes
·
View notes
Akira Kurosawa chat 🐱 !!!! @lespetitesmains.tattooshop ----------------------------------- Contact✉️:
[email protected] ----------------------------------- Residence: Toulouse 🖤 ----------------------------------- #tattoo #blacktattoo #blackwork #blackworkers #onlyblackart #tttism #txttooing #tattoodo #flashtattoo #tattooflash #blackworkerssubmission #blacktattooart #hblacktattooing #ink #txttoing #blackink #inkedgirl #dot #dotwork #dotworkers #toulouse #toulousetattoo #tattootoulouse #ophelietaki #akira #akirakurosawa #lesseptsamouraïs #cat #cattattoo #tattoocat (à Toulouse, France) https://www.instagram.com/p/Bw2FinnH37L/?utm_source=ig_tumblr_share&igshid=12syvjs7axv0l
2 notes
·
View notes
By @ophelie_taki #Repost @ophelie_taki with @repostapp ・・・ 🌸POLISHGIRLS ARE THE BEST🌸Merci Sandra pour toutes ces mortelles sessions passées avec toi !!! ----------------------------------- Contact✉️:
[email protected] ----------------------------------- Residence: Toulouse 😎❤️ ✈️BIARRITZ 11-15 juillet (electric dragon tattoo) ✈️MARSEILLE 22-25 août (Canine) ✈️ROUEN Mort Bleue convention ✈️LISBOA conv Lyon, Liege.... ----------------------------------- #tattoo #blacktattoo #blackwork #blackworkers #onlyblackart #blacktattoomag #darkartists #TTTism #tattoodo #txttooing #blackworkerssubmition #scorpion #scorpiontattoo #blacktattooart #blacktattooing #blacktattoomag #ink #txttoing #blackink #inkedgirl #dot #dotwork #dotworkers #toulouse #toulousetattoo #tattootoulouse #ophelietaki #flowerstattoo (à Mojito Tattoo)
1 note
·
View note
Tattoo by @thedirtytommy for sweet @denisemoetattoo ⚡ #thedirtytommy #bright_and_bold #realtattoos #topclasstattooing #bird #besttradtattoos #skull #bcnttt #oldlines #tradworkers #tattoodo #tattoolifemagazine #txtto #tattoodo #tdpsubmissions (presso Oneonine Barcelona)
2 notes
·
View notes
*not so casually sends nude to roose.* 😝
Texts from Roose
[txtto: Isyla] As lovely as that was, I was teaching History 100, and my ipad was bluetoothed to the projector screen.
[txtto: Isyla] On the other hand, I’ve been getting high fives from undergrads all afternoon
1 note
·
View note
Gibson's Girls Flash | these women designed by Charles Dana Gibson at the 20's become a beauty ideal in America. This images influenced old tattooists in what would became the popular "Pin-up head" designs. Almost 100 years later, and after a lot of changes in the meanings and structures, these ladies are still part of a visual culture. In this serie I studied the iconography in a classic motive and its reconfiguration through time. #charleadanagibson #gibsongirl #americanbeauty #visualconcept #visualconceptstattoo #contemporarytattooing #tatuagemcontemporanea #tttism #tattrx #stabmegodsubmission #brasiliatattoofestival #brasiliatattoo #vctopenair #tattootravelers #vawaa #followthecolours #darkartists #equilattera #inkstateofmind #inkinstinctsubmission #tattoo2me #tttpublishing #blackwork #blackworksubmission #tattooarmadasubmission #txttoing #BolognaTattoo (at Bologna, Italy)
5 notes
·
View notes
https://ovc.ncjrs.gov/ovcproviderforum/asp/sub.asp?Topic_ID=244&hidPageThread=1&sortThreads=DESC&hidPageName=sub.asp&hidParentPage=sub.asp&lstTopics=&txtKeyword=&txtFrom=&txtTo=
0 notes
🌹 para Fran. Muchas gracias!!! ☺️ . . . . . #safespace #rose #rosetattoo #lgtbqi #sacredarttattoos #dalston #stokey #londontattoo #tattoo #botanicaltattoo #fusionink #tattooart #queer #qttr #qbmc #pics_of_inked_ #txttoing #ink #ldnttt #equilattera #skinart #txtoo #tattrx (at Sacred Art Tattoos) https://www.instagram.com/p/CGCfYfyHTdw/?igshid=1q3px5zxwhm0v
1 note
·
View note
☕️ coffee by @arochatattoo . . . . #lgtbqi #dalston #stokey #london #londontattoo #tattoo #blackwork #blkttt #tattooart #queerart #queer #qttr #qbmc #pics_of_inked_ #ttt #txttoing #ink #parloiruk #ldnttt #blakworkers #dsrupttt #tttism #equilattera #blkttt #skinart #txtoo #tattrx #coffeeplant #coffeetattoo #botanicaltattoo (at London, United Kingdom) https://www.instagram.com/p/B9d2fJBFfAS/?igshid=10klp5oje0v2u
1 note
·
View note
Arowana fish by @arochatattoo on @goatkeeper_ 🖤🖤🖤 . . . . . #arowana #arowanafish #lgtbqi #dalston #stokey #london #londontattoo #tattoo #tattooart #queerart #queer #qttr #qbmc #pics_of_inked_ #ttt #txttoing #ink #parloiruk #ldnttt #dsrupttt #tttism #equilattera #skinart #txtoo #tattrx #fishtattoo (at London, United Kingdom) https://www.instagram.com/p/B9T2i0KFKoN/?igshid=xoolow7u1z6a
1 note
·
View note
Babe by @babysnaketattoo . . . . . . #sacredartlondon #safespace #dsntlumen #apprenticetattoo #tattooapprentice #femaletattooartist #blacktattoo #firsttattoo #londontattoo #linetattoo #ldnttt #sacredarttattoos #dalston #contemporarytattooing #blkttt #tattooart #flash #pics_of_inked_ #ttt #txttoing #parloiruk #tttism #blkttt #skinart #txtoo #tattrx (at London, United Kingdom) https://www.instagram.com/p/B7amNYBFaqa/?igshid=1esla43mki0bn
1 note
·
View note
🌻 by @arochatattoo . . . . . . . #safespace #sacredart #lgtbqi #sacredarttattoos #sacredartlondon #dalston #stokey #london #londontattoo #tattoo #blackwork #blkttt #tattooart #queerart #queer #qttr #qbmc #ttt #txttoing #ink #blakworkers #tttism #equilattera #blkttt #skinart #txtoo #tattrx #fusionink (at Sacred Art Tattoos) https://www.instagram.com/p/B7YCz5BlJUN/?igshid=wnzhkn2s6207
1 note
·
View note
From Angel Cop by @goatkeeper_ . . . . #safespace #sacredart #lgtbqi #sacredarttattoos #sacredartlondon #london #londontattoo #tattoo #blackwork #blkttt #queerart #queer #qttr #qbmc #flash #pics_of_inked_ #ttt #tttism #txttoing #ink #parloiruk #ldnttt #blakworkers #parloiruk #tttism #blkttt #skinart #angelcop (at London) https://www.instagram.com/p/B4W9571FBGm/?igshid=btdtguoh7q2i
1 note
·
View note
Pickling cucumber🥒 by resident @arochatattoo #safespace #sacredart #lgtbqia #sacredarttattoos #sacredartlondon #dalston #stokey #london #londontattoo #tattoo #tattooart #queerart #queer #qttr #qbmc #pics_of_inked_ #ttt #tttism #txttoing #ink #parloiruk #ldnttt #pickle #pickletattoo #botanicaltattoo (at London, United Kingdom) https://www.instagram.com/p/B08oUmRFctn/?igshid=19qsoykemeyf3
1 note
·
View note