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 76fafd117669b7f543e0b34be8a62b3cf095428f..15ff6b5a3caba11c55dab36001e072a8437a11ab 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 491ab3c7254840f476270abd60f8c6f33e478004..86d0d2331acd6c8374219c9c740c82b40fe5e2c3 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')