Getting Started?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 or sudo pip install tweepy Using TweepyThe 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 TimelineYou 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 / NotificationsThis 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.
![]()
|
The Twitter-BotCombining 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 DataA 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.
![]()
|
- Home
- Python
- Ras Pi
-
Pi Hardware
- Pi-Hacks
-
Pi-Hacks 2
- The Joker
- Hologram Machine
- Google Vision: Camera Tell
- Yoda Tweets
- Pi Phone
- Darth Beats
- Twitter Keyword Finder
- Crimbo Lights Hack
- Xmas Elf
- Halloween 2016
- Halloween Hack 2015
- Socrative Zombie
- Voice Translation
- The Blue-Who Finder
- GPIO, Twitter
- Pi Chat Bot >
- PiGlow & Email
- Pibrella Alarm System
- SMS with Python >
- Pi-Hacks 3
- Minecraft
- Computing
- Contact Me
- Random Hacks