This is an ALTERNATIVE module to use instead of Twython. It is still simple to install and I found that it overcome some of the streaming issues I was encountering when trying to print my Tweets / messages.
As before you require a token, go to the Twitter API site and register your details. This is required to create the Authentication Token and Access Token.
Once you have created your own account and you have the authorisation codes and tokens the program can be created.
First Update the Raspberry Pi
sudo apt-get update
Upgrade your Pi
sudo apt-get upgrade
Next install the python setup tools and pip, use this to install the Twython module that will allow the communication between the twitter API and Python.
sudo apt-get install python-setuptools
sudo easy_install tweepy
sudo pip install tweepy
The code is very similar to the Twython methods however at present the public timeline is not working. Further documentation can be found here.
Streaming your Timeline
You own Tweets / timeline can be stream using the simple api.user_timeline() this returns a few of your most recent posts to twitter.
Getting your Mentions / Notifications
This simple code api.mentions_timeline() returns the contents of your notifications / mentions. It does not return new followers only messages in which your Twitter ID is mentioned.
Combining the Tweepy code and the Talking Pi code at here, you can create a very simple Twitter Bot that reads out or speaks your timeline or your mentions from your timeline. Code and example are shared below, just add your own Tokens.
Getting Twitter Users Data
A simple variation of the basic code that searches for a Twitter Users ID and then returns the number of Followers, Mentions, Tweets etc. The program enables you to enter in a users ID and then it returns their data.
- Raspberry Pi
- Contact Me
- Hologram Machine