]> jfr.im git - z_archive/twitter.git/commitdiff
update img sending doc
authorRouxRC <redacted>
Mon, 22 Sep 2014 18:06:22 +0000 (20:06 +0200)
committerRouxRC <redacted>
Mon, 22 Sep 2014 18:06:22 +0000 (20:06 +0200)
README
twitter/api.py

diff --git a/README b/README
index c2e6d789a36d747285e33111c1e84a9be084c83c..ff75ab929d6d6c8e9f67537446cc047cede34dbf 100644 (file)
--- a/README
+++ b/README
@@ -125,12 +125,14 @@ t.statuses.oembed(_id=1234567890, _method='GET')
 
 # 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)
 ```
 
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)