This commit is contained in:
Miroslav Stampar 2015-09-23 15:31:25 +02:00
parent aa088aafd2
commit 29bdcf0e65

View File

@ -100,7 +100,7 @@ class MultipartPostHandler(urllib2.BaseHandler):
# buf += 'Content-Length: %s\r\n' % file_size # buf += 'Content-Length: %s\r\n' % file_size
fd.seek(0) fd.seek(0)
buf = str(buf) buf = str(buf) if not isinstance(buf, unicode) else buf.encode("utf8")
buf += '\r\n%s\r\n' % fd.read() buf += '\r\n%s\r\n' % fd.read()
buf += '--%s--\r\n\r\n' % boundary buf += '--%s--\r\n\r\n' % boundary