From: Matthew Vernon Date: Thu, 17 Nov 2016 16:19:03 +0000 (+0000) Subject: Updates for newer version of python-twitter (new twitter API) X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=e769da6e9c65ea9b8f4f58d5d5f0e0ef31643797;p=irc.git Updates for newer version of python-twitter (new twitter API) 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 --- diff --git a/Servus-chiark.py b/Servus-chiark.py index 76fafd1..15ff6b5 100755 --- a/Servus-chiark.py +++ b/Servus-chiark.py @@ -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() diff --git a/commands.py b/commands.py index 491ab3c..86d0d23 100755 --- a/commands.py +++ b/commands.py @@ -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')