cairo-dock-team team mailing list archive
-
cairo-dock-team team
-
Mailing list archive
-
Message #05453
[Merge] lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter into lp:cairo-dock-plug-ins-extras
Eduardo Mucelli Rezende Oliveira has proposed merging lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter into lp:cairo-dock-plug-ins-extras.
Requested reviews:
Cairo-Dock Third-Party (cairo-dock-third-party)
For more details, see:
https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter/+merge/179046
Twitter: Updated twitter api to the version 1.1
--
https://code.launchpad.net/~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter/+merge/179046
Your team Cairo-Dock Third-Party is requested to review the proposed merge of lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter into lp:cairo-dock-plug-ins-extras.
=== modified file 'Twitter/ChangeLog'
--- Twitter/ChangeLog 2012-05-20 12:59:43 +0000
+++ Twitter/ChangeLog 2013-08-07 20:36:26 +0000
@@ -1,3 +1,4 @@
+0.4.4 (August/7/2013): Converted twitter API to the version 1.1.
0.4.1 (May/20/2012): Added home timeline on Identi.ca.
0.4: (May/18/2012): Fully supporting individually account log-in. Code improvements, refactoring, and bug fixes.
0.3: (May/13/2012): Added support to Identi.ca! Many code changes, refactoring, and improving.
=== modified file 'Twitter/Twitter.conf'
--- Twitter/Twitter.conf 2012-11-05 14:51:51 +0000
+++ Twitter/Twitter.conf 2013-08-07 20:36:26 +0000
@@ -1,4 +1,4 @@
-#0.4.3
+#0.4.4
#[gtk-about]
[Icon]
=== modified file 'Twitter/auto-load.conf'
--- Twitter/auto-load.conf 2012-11-05 14:51:51 +0000
+++ Twitter/auto-load.conf 2013-08-07 20:36:26 +0000
@@ -10,7 +10,7 @@
category = 3
# Version of the applet; change it everytime you change something in the config file. Don't forget to update the version both in this file and in the config file.
-version = 0.4.3
+version = 0.4.4
# Whether the applet can be instanciated several times or not.
multi-instance = true
=== modified file 'Twitter/twitter.py'
--- Twitter/twitter.py 2013-02-28 00:04:13 +0000
+++ Twitter/twitter.py 2013-08-07 20:36:26 +0000
@@ -101,7 +101,7 @@
def __init__(self, access_key, access_secret, callback):
Twitter.API.__init__(self, access_key, access_secret)
- self.user_stream_url = "https://userstream.twitter.com/2/user.json"
+ self.user_stream_url = "https://userstream.twitter.com/1.1/user.json"
self.callback = callback # called as soon as a new entry on the stream appears
thread = threading.Thread(target=self.tweet_streaming) # keep checking for new entries on the stream
thread.start() # run, forrest run
@@ -126,22 +126,25 @@
if len(tweets) > 1:
content = tweets[0]
if "text" in content:
- content = simplejson.loads(content)
- logp("Received from Twitter Stream: %s" % content)
- self.callback(content) # callback == Twitter.on_receive_new_entry_into_stream_callback
+ try:
+ content = simplejson.loads(content)
+ logp("Received from Twitter Stream: %s" % content)
+ self.callback(content) # callback == Twitter.on_receive_new_entry_into_stream_callback
+ except ValueError: # in some strange circumstances the content may not be a valid json
+ pass
buffer = tweets[1]
class TwitterAPI(API):
def __init__(self, access_key, access_secret):
Twitter.API.__init__(self, access_key, access_secret)
- self.update_url = 'https://api.twitter.com/1/statuses/update.json'
- self.home_timeline_url = 'https://api.twitter.com/1/statuses/home_timeline.json'
- self.direct_messages_url = 'https://api.twitter.com/1/direct_messages.json'
- self.new_direct_messages_url = 'https://api.twitter.com/1/direct_messages/new.json'
- self.verify_credentials_url = 'https://api.twitter.com/1/account/verify_credentials.json'
- self.user_timeline_url = 'https://api.twitter.com/1/statuses/user_timeline.json'
- self.retweet_url_prefix = 'https://api.twitter.com/1/statuses/retweet/' # lacks the id of the tweet to be retweeted
+ self.update_url = 'https://api.twitter.com/1.1/statuses/update.json'
+ self.home_timeline_url = 'https://api.twitter.com/1.1/statuses/home_timeline.json'
+ self.direct_messages_url = 'https://api.twitter.com/1.1/direct_messages.json'
+ self.new_direct_messages_url = 'https://api.twitter.com/1.1/direct_messages/new.json'
+ self.verify_credentials_url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
+ self.user_timeline_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'
+ self.retweet_url_prefix = 'https://api.twitter.com/1.1/statuses/retweet/' # lacks the id of the tweet to be retweeted
def dispatch(self, url, mode, parameters={}):
oauth_request = oauth.OAuthRequest.from_consumer_and_token(self.consumer,
Follow ups