chiark / gitweb /
Updates for newer version of python-twitter (new twitter API)
authorMatthew Vernon <matthewv@chiark.greenend.org.uk>
Thu, 17 Nov 2016 16:19:03 +0000 (16:19 +0000)
committerMatthew Vernon <matthewv@chiark.greenend.org.uk>
Thu, 17 Nov 2016 16:19:03 +0000 (16:19 +0000)
These are changes to support what will eventually be version 3.2 of
python-twitter; for the time being we are running of a git clone of
the devel branch, which supports the newer twitter API (so e.g. tweets
quoting other tweets work properly); it doesn't look like an upstream
release of 3.2 is going to happen any time soon.

Author: Adam Bernard
Signed-off-by: Matthew Vernon
Servus-chiark.py
commands.py

index 76fafd1..15ff6b5 100755 (executable)
@@ -190,7 +190,8 @@ try:
   twitapi = twitter.Api(consumer_key = twoaapck,
                        consumer_secret = twoaapcs,
                        access_token_key = twoapat,
-                       access_token_secret = twoapats)
+                       access_token_secret = twoapats,
+                        tweet_mode = "extended")
 except IOError:
 # non-authenticated twitter api instance
   twitapi = twitter.Api()
index 491ab3c..86d0d23 100755 (executable)
@@ -521,7 +521,7 @@ def getTweet(urlstring,twitapi,inclusion=False):
     else:
         tweeter_screen = "[not returned]" ; tweeter_name = "[not returned]"
         tweeter_name = tweeter_name + " RTing " + status.user.name #.encode('UTF-8', 'replace')
-    tweetText = status.text
+    tweetText = status.full_text
     if status.media:
         replacements = defaultdict( list )
         for medium in status.media:
@@ -593,5 +593,4 @@ def getTweet(urlstring,twitapi,inclusion=False):
     stringout = "Error: %s" % terror[1].__str__()
   if inclusion:
       return stringout # don't want to double-encode it, so just pass it on for now and encode later
-  print stringout.encode('UTF-8', 'replace')
   return stringout.encode('UTF-8', 'replace')