Merge lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter into lp:~cairo-dock-third-party/cairo-dock-plug-ins-extras/third-party

Proposed by Eduardo Mucelli Rezende Oliveira
Status: Merged
Merged at revision: 379
Proposed branch: lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter
Merge into: lp:~cairo-dock-third-party/cairo-dock-plug-ins-extras/third-party
Diff against target: 80 lines (+17/-13)
4 files modified
Twitter/ChangeLog (+1/-0)
Twitter/Twitter.conf (+1/-1)
Twitter/auto-load.conf (+1/-1)
Twitter/twitter.py (+14/-11)
To merge this branch: bzr merge lp:~eduardo-mucelli/cairo-dock-plug-ins-extras/Twitter
Reviewer Review Type Date Requested Status
Matthieu Baerts Approve
Review via email: mp+179046@code.launchpad.net

Description of the change

Twitter: Updated twitter api to the version 1.1

To post a comment you must log in.
379. By Eduardo Mucelli Rezende Oliveira

Updating Twitter to the API 1.1

Revision history for this message
Eduardo Mucelli Rezende Oliveira (eduardo-mucelli) wrote :

Matttbe, are you guys still using the lastmodif file? If so, is the format YYYYMMDD or YYYYDDMM? I always forget to update it.

Revision history for this message
Matthieu Baerts (matttbe) wrote :

Hello Eduardo and thank you for these modifications ;)

It looks fine (even if I'm not able to test it right now ;) ).

We are still using 'last-modif' file but this file is managed by the dock, no need to modify it ;) (it's used to know if the dock has to update this applet or not).
But is it possible to modify the 'last-modif' entry of your Twitter applet in 'list.conf' file too? We regularly forgot it :)
Format is YYYYMMDD (this number has to be bigger each day)

Then, you can push your modifications on the main branch ;)
(or I can do that if you prefer)

Also: here is just a 2 tips/advices (mostly details):
 * About the commit message, it's maybe better to start it with the name of the applet (just "Twitter: Updating (...)") => For more advices about the commit message, please have a look there: http://www.glx-dock.org/ww_page.php?p=Help%20us%20with%20BZR&lang=en#18-About%20the%20commit%20message
 * No need to bump the version number of your applet if you don't change the .conf file (but you can do that if you want to have a detailed changelog for each modification but you can also have a version number and a lot of changes and in your ChangeLog file, you can add the date ;) )

Have a nice day,

Matt

review: Needs Fixing
Revision history for this message
Matthieu Baerts (matttbe) wrote :

Hello Eduardo,

I re-post a new comment just because I know that these mails you receive about these merge requests are not so clear (I think you already told me that you didn't see previous comments that I made here :) )

So it's just to know if you saw my previous comment :) (and if you prefer that I answer to your question on Cairo-Dock's forum, here or by e-mails)

Revision history for this message
Eduardo Mucelli Rezende Oliveira (eduardo-mucelli) wrote :

Heya! I see your comments by e-mail. Actually I misunderstood your previous comment, and neglected the list.conf change. I will do it as soon as I get back home.

The commit message ... yes, I always forget it. I end up adding the applet name only on the merge message. Anyway, I will try my best to remember next times, promised :-)

The .conf file, ok, got it. I will keep tracking inside Changelog and let the version static until I change something inside .conf.

Cheers!

Revision history for this message
Matthieu Baerts (matttbe) wrote :

Ok, thank you :)

About the commit message, yes, it's a detail, it's not so important ;) but it's just... better :P

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Twitter/ChangeLog'
2--- Twitter/ChangeLog 2012-05-20 12:59:43 +0000
3+++ Twitter/ChangeLog 2013-08-07 20:36:26 +0000
4@@ -1,3 +1,4 @@
5+0.4.4 (August/7/2013): Converted twitter API to the version 1.1.
6 0.4.1 (May/20/2012): Added home timeline on Identi.ca.
7 0.4: (May/18/2012): Fully supporting individually account log-in. Code improvements, refactoring, and bug fixes.
8 0.3: (May/13/2012): Added support to Identi.ca! Many code changes, refactoring, and improving.
9
10=== modified file 'Twitter/Twitter.conf'
11--- Twitter/Twitter.conf 2012-11-05 14:51:51 +0000
12+++ Twitter/Twitter.conf 2013-08-07 20:36:26 +0000
13@@ -1,4 +1,4 @@
14-#0.4.3
15+#0.4.4
16
17 #[gtk-about]
18 [Icon]
19
20=== modified file 'Twitter/auto-load.conf'
21--- Twitter/auto-load.conf 2012-11-05 14:51:51 +0000
22+++ Twitter/auto-load.conf 2013-08-07 20:36:26 +0000
23@@ -10,7 +10,7 @@
24 category = 3
25
26 # 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.
27-version = 0.4.3
28+version = 0.4.4
29
30 # Whether the applet can be instanciated several times or not.
31 multi-instance = true
32
33=== modified file 'Twitter/twitter.py'
34--- Twitter/twitter.py 2013-02-28 00:04:13 +0000
35+++ Twitter/twitter.py 2013-08-07 20:36:26 +0000
36@@ -101,7 +101,7 @@
37 def __init__(self, access_key, access_secret, callback):
38 Twitter.API.__init__(self, access_key, access_secret)
39
40- self.user_stream_url = "https://userstream.twitter.com/2/user.json"
41+ self.user_stream_url = "https://userstream.twitter.com/1.1/user.json"
42 self.callback = callback # called as soon as a new entry on the stream appears
43 thread = threading.Thread(target=self.tweet_streaming) # keep checking for new entries on the stream
44 thread.start() # run, forrest run
45@@ -126,22 +126,25 @@
46 if len(tweets) > 1:
47 content = tweets[0]
48 if "text" in content:
49- content = simplejson.loads(content)
50- logp("Received from Twitter Stream: %s" % content)
51- self.callback(content) # callback == Twitter.on_receive_new_entry_into_stream_callback
52+ try:
53+ content = simplejson.loads(content)
54+ logp("Received from Twitter Stream: %s" % content)
55+ self.callback(content) # callback == Twitter.on_receive_new_entry_into_stream_callback
56+ except ValueError: # in some strange circumstances the content may not be a valid json
57+ pass
58 buffer = tweets[1]
59
60 class TwitterAPI(API):
61 def __init__(self, access_key, access_secret):
62 Twitter.API.__init__(self, access_key, access_secret)
63
64- self.update_url = 'https://api.twitter.com/1/statuses/update.json'
65- self.home_timeline_url = 'https://api.twitter.com/1/statuses/home_timeline.json'
66- self.direct_messages_url = 'https://api.twitter.com/1/direct_messages.json'
67- self.new_direct_messages_url = 'https://api.twitter.com/1/direct_messages/new.json'
68- self.verify_credentials_url = 'https://api.twitter.com/1/account/verify_credentials.json'
69- self.user_timeline_url = 'https://api.twitter.com/1/statuses/user_timeline.json'
70- self.retweet_url_prefix = 'https://api.twitter.com/1/statuses/retweet/' # lacks the id of the tweet to be retweeted
71+ self.update_url = 'https://api.twitter.com/1.1/statuses/update.json'
72+ self.home_timeline_url = 'https://api.twitter.com/1.1/statuses/home_timeline.json'
73+ self.direct_messages_url = 'https://api.twitter.com/1.1/direct_messages.json'
74+ self.new_direct_messages_url = 'https://api.twitter.com/1.1/direct_messages/new.json'
75+ self.verify_credentials_url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
76+ self.user_timeline_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'
77+ self.retweet_url_prefix = 'https://api.twitter.com/1.1/statuses/retweet/' # lacks the id of the tweet to be retweeted
78
79 def dispatch(self, url, mode, parameters={}):
80 oauth_request = oauth.OAuthRequest.from_consumer_and_token(self.consumer,

Subscribers

People subscribed via source and target branches