Herman Schistad added the comment: I can confirm that this patch solves the issues I've had where I can submit multipart forms provided I have a string URL, but not if it's unicode.
I'm using Python 2.7.12. Applying the patch fixes the issue. Code which breaks, assuming the file contains binary data: # -*- encoding: utf-8 -*- import urllib3 pool_manager = urllib3.PoolManager(num_pools=2) url = u'http://example.org/form' # removing the 'u' fixes it content = open('/some/binary/file').read() fields = [ ('foo', 'something'), ('bar', ('/some/binary/file', content, 'application/octet-stream')) ] pool_manager.request("POST", url, fields=fields, encode_multipart=True, headers={}) ---------- nosy: +Herman Schistad _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22231> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com