diff --git a/twython.py b/twython.py index 5afadf0..dd0cd27 100644 --- a/twython.py +++ b/twython.py @@ -1257,7 +1257,7 @@ class setup: """ if self.authenticated is True: try: - files = [("image", filename, open(filename).read())] + files = [("image", filename, open(filename, 'rb').read())] fields = [] content_type, body = self.encode_multipart_formdata(fields, files) headers = {'Content-Type': content_type, 'Content-Length': str(len(body))} @@ -1278,7 +1278,7 @@ class setup: """ if self.authenticated is True: try: - files = [("image", filename, open(filename).read())] + files = [("image", filename, open(filename, 'rb').read())] fields = [] content_type, body = self.encode_multipart_formdata(fields, files) headers = {'Content-Type': content_type, 'Content-Length': str(len(body))} diff --git a/twython3k.py b/twython3k.py index 2c34ab9..08db6ad 100644 --- a/twython3k.py +++ b/twython3k.py @@ -1257,7 +1257,7 @@ class setup: """ if self.authenticated is True: try: - files = [("image", filename, open(filename).read())] + files = [("image", filename, open(filename, 'rb').read())] fields = [] content_type, body = self.encode_multipart_formdata(fields, files) headers = {'Content-Type': content_type, 'Content-Length': str(len(body))} @@ -1278,7 +1278,7 @@ class setup: """ if self.authenticated is True: try: - files = [("image", filename, open(filename).read())] + files = [("image", filename, open(filename, 'rb').read())] fields = [] content_type, body = self.encode_multipart_formdata(fields, files) headers = {'Content-Type': content_type, 'Content-Length': str(len(body))}