Contents
ShowTweets
Description
Displays twitter messages (aka tweets) from a users timeline.
Download & Release Notes
Download |
Release Version |
Moin Version |
Release Notes |
0.6.1 |
1.9.7 |
now only python-tweepy needed for dependencies, but works only with python 2.6 / 2.7 (tweepy disabled 2.5 support) |
|
0.4 (ALPHA) |
1.8.x / 1.9.x |
pep8 and tested with 1.9 |
|
0.3 (ALPHA) |
1.8.x |
adding date, addedd css_class, optimized maxTweets, optimizing error oupput, render tweet as wiki text, added simple basic caching |
|
0.1 (ALPHA) |
1.8.x |
be aware; this is an alpha version and not everything is done |
Dependencies:
Twitter for Python: http://tweepy.github.io/ (e.g. install with easy_install tweepy )
Initial Configuration
Since twitter requires OAUTH, you have to register this "macro" on twitter:
consumer_key / consumer_secret = under https://dev.twitter.com/apps (under "OAuth settings")
access_token / access_token_secret = under https://dev.twitter.com/apps (located under "Your access token")
and configure those into your macro ShowTweets.py:
1 #OAUTH configuration (you have to configure this!)
2 consumer_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
3 consumer_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
4 access_token="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
5 access_token_secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
6 auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
7 auth.set_access_token(access_token, access_token_secret)
Parameters
Optional macro parameters are:
user=TwitterUserAccount
if no twitter username is given, your own is used.maxTweets=10
how many tweets should be fetched (default 10)noReply=True
show no reply tweets
Security
Be aware that if you configure & use this macro on a "public" wiki, other users can access (with your credentials!!!) other twitter acounts. To avoid this you can add a fixed username, e.g somewhere in the #Initial stuff area, like:
1 user = "<twitteraccount>"
Example
To display the tweets from the User "twitter" do this:
<<ShowTweets("twitter")>>
screenshot how it could look:
Copyright & Licence
2009, 2010, 2013 by MarcelHäfner (http://moinmo.in/MarcelHäfner) / GNU GPL, see COPYING for details.
Licences for dependencies:
- Tweepy is under MIT Licence
Bugs
Discussion
2010-05-19: Tipps
Hi
cool, we should have had that too for our python bar camp. But we will for the next one. It needs some little more work
Please have a look at the indenting. fixed
looks strange because of def macro_ShowTweets(macro, user=u"Twitter",maxTweets=10, debug=False) it is user, or? user = twitter user account
api = twitter.Api(username=username,.. won't work too removed, and added a note how to activate
if debug == False: if not debug: not needed
Please escape also the content of the tweet. sure
cheers
-- ReimarBauer 2010-05-19 16:47:13
many thanks for you tricks & tipps -- MarcelHäfner 2010-05-20 23:44:59
The date and time of the Tweets are always the date and time of the top entry. The index of statuses in line 115 should be tweetCount. The variable tweetNumber in line 78 is unused then and can be deleted. -- DirkAlders 2014-01-18 15:41:17
Patch for tweepy
My patch to fix this by switching from python-twitter to tweepy: http://pastebin.com/ZnX2qJsf and add an option to hide @replies from results. -- FelixYan 2024-12-23 03:41:11 integrated, thanks