]> jfr.im git - z_archive/twitter.git/blobdiff - twitter/api.py
update img sending doc
[z_archive/twitter.git] / twitter / api.py
index c176d57d437a96e3717ff0af5f999904508cc18c..14fe20e183dd64eed4a21c2d60b12aa5082ddf41 100644 (file)
@@ -366,12 +366,14 @@ class Twitter(TwitterCall):
 
         # Send a tweet with an image included (or set your banner or logo similarily)
         # by just reading your image from the web or a file in a string:
+        # Note that the text sent as status along with the picture must be unicode.
+        status = u"PTT ★"       # or with python 3: status = "PTT ★"
         with open("example.png", "rb") as imagefile:
-            params = {"media[]": imagefile.read(), "status": "PTT"}
+            params = {"media[]": imagefile.read(), "status": status}
         t.statuses.update_with_media(**params)
 
         # Or by sending a base64 encoded image:
-        params = {"media[]": base64_image, "status": "PTT", "_base64": True}
+        params = {"media[]": base64_image, "status": status, "_base64": True}
         t.statuses.update_with_media(**params)