valhallasw added a comment.
There are several issues. The requests has several unicode parts, which causes the entire request to be cast to a unicode string. Of course, this fails once we want to send binary data (namely, the file contents). At least the following ones are wrong:
- **u'POST /w/api.php HTTP/1.1'** - 'Host: commons.wikimedia.org' - 'Content-Length: 743405' - 'accept-encoding: gzip, deflate' - **u'user-agent: test (commons:commons; User:Valhallasw) Pywikibot/2.0b3 (g5524) httplib2/0.9 Python/2.7.6.final.0'** - **u'connection: keep-alive'** - 'cookie: (...)' - 'content-type: multipart/form-data; boundary="===============1715999916774184062=="' - 'mime-version: 1.0'
and this may have something to do with the introduction of unicode_literals at some place.
TASK DETAIL https://phabricator.wikimedia.org/T99366
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: zhuyifei1999, valhallasw Cc: valhallasw, XZise, Aklapper, zhuyifei1999, jayvdb, pywikipedia-bugs