Raspberry Pi is famous for its great computing strength and ability to run the Linux operating system. In today’s tutorial, you’ll learn how to make your Raspberry Pi tweet. You can add extra features to this project to post tweets autonomously if any specific event occurs. Let’s get started.
You’ll need following parts to make this project.
- Raspberry Pi running Raspbian OS (Any model)
- USB Mouse
- USB Keyboard
- HDMI Compatible Monitor
- HDMI Cable
- USB power supply for Raspberry (5V 2A)
- Working Internet Connection
Create App In Twitter
You need to create an app in Twitter so that Raspberry Pi can use to make tweets on your behalf. Go here to make a twitter app. The Raspberry Pi will require following parameters to make tweets:
- Consumer Key (API Key)
- Consumer Secret (API Secret)
- Access Token
- Access Token Secret
You can find all these details from your app.
Store Keys In Raspberry Pi
In this step, you need to create a python file in your Raspberry Pi and store all the Keys and Tokens there. Create a file named keys.py in your working folder with all information in it.
consumer_key = "Place your consumer key here" consumer_secret = "Place your consumer secret key here" access_token = "Place the access token here" access_token_secret = "place the access token secret here
Now, save the file and go the nex step of this tutorial.
Well, what is Twython actually? Twython is the premier Python library providing an easy way to access the Twitter data. It’s been tested by companies, educational institutions and individuals alike. This amazing library will make our job a lot easier and the code much shorter. To install the Twython library, follow the given steps:
Read more: Post Tweets With Your Raspberry Pi