From 5dd22c23f203e8b1f1747add8c1d329409356be4 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 15 May 2018 08:44:13 -0700 Subject: [PATCH] Patch Twitter str encoding for Python 2 --- lib/twitter/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/twitter/api.py b/lib/twitter/api.py index 60d5851b..0e8f118f 100644 --- a/lib/twitter/api.py +++ b/lib/twitter/api.py @@ -1103,10 +1103,10 @@ class Api(object): except KeyError: raise TwitterError({'message': 'Media could not be uploaded'}) - boundary = bytes("--{0}".format(uuid4()), 'utf-8') + boundary = bytes("--{0}".format(uuid4())).encode('utf-8') media_id_bytes = bytes(str(media_id).encode('utf-8')) headers = {'Content-Type': 'multipart/form-data; boundary={0}'.format( - str(boundary[2:], 'utf-8'))} + str(boundary[2:]).encode('utf-8'))} segment_id = 0 while True: