Reporter Bot
Tags: python, iot, twitter, balenaio
Published: 2020-01-28 08:15:05

---
title: Reporter Bot
published: true
description: A simple python script for reporting the follower status
tags: python, IoT, twitter, balena.io
cover_image: https://static.makeuseof.com/wp-content/uploads/2016/03/twitter-bot-raspberry-pi-670x335.jpg
---

In this module we will learn how to run a simple python script for reporting the follower status of twitter accounts, with support for multiple account additions and google text to speech service, awesome experience!

<hr/><br/>

## STEPS
* [Clone Repo](#chapter-1)
* [Install Python](#chapter-2)
* [Create Twitter Account](#chapter-3)
* [Install Script Packages](#chapter-4)
* [Add Keys](#chapter-5)
* [Run Now!](#chapter-6)
* [Run After Restart](#chapter-7)
* [Error Logs](#chapter-8)

<hr/><br/>

### 1. Clone Repo <a name="chapter-1"></a>: 
Ok so let's begin this awesome journey by clicking [here](https://github.com/Open-Clonne/scripts/tree/master/reporterbots/twitter), which will redirect you to the master tree for the python scripts, feel free to use any tool you want to clone or simply click on the download button or you can copy the git clone url and use the `git clone {repo_url}` command if you feeling fancy.

<hr/><br/>

### 2. Install Python <a name="chapter-2"></a>: 
Now in order to run the script, you need to install `PYTHON-3.7` for your environment, a simple google search will help you get the file and install process. After you are done run these two commands respectively in your terminal or command prompt 
```bash
python3 --version && pip3 --version
``` 

this will print the python version and the python package manager versions respectively. Cool!

<hr/><br/>

### 3. Create Twitter Account <a name="chapter-3"></a>: 
Since you might be testing, simply goto [Twitter](https://twitter.com/) and create a test account, after that also visit [Twitter Developers](https://developer.twitter.com/) and sign up for a developer account. Now you might be required to verify your email or phone number, just go through with it. Upon completion, goto the dashboard and point your cursor the top right corner, hover over the links and find the `Apps` option, click on that and create an app, also go through the requirements like you did before. That's all, that was a long one! LOL... anyway please keep the browser tab open, we will be back for some keys.

<hr/><br/>

### 4. Install Script Packages <a name="chapter-4"></a>: 
The script you just cloned needs a couple of other packages to run smoothly, so simply change directory into the folder from your terminal and run this command 
```bash
pip3 install -r requirements.txt
``` 
This will get and install everything for you. Finally something simple!

<hr/><br/>

### 5. Add Keys <a name="chapter-5"></a>: 
In this step, we will add in our twitter api keys, so head to the cloned folder and open the `keys.py` file up in your favourite editor. Now goto to your twitter developer dashboard and click on your app then select the "Access Tokens" tab, you wouldn't have the access keys generated for you so click on the generate button to get one. Now in the `keys.py` file you would see the labels for each key in there, simply copy and paste them respectively. That's all for the `keys.py` file. Hurraay!!!

<hr/><br/>

### 6. Run Now! <a name="chapter-6"></a>: 
So excited!, now let's run what we've been waiting for, simply change directory into the cloned folder if you have not done that already and run this command 
```bash
python3 main.py
``` 
this will boot up the bot and start printing what it is up to on the terminal to keep you informed, now goto you twitter account watch as the magic you just setup happens!.

<hr/><br/>

### 7. Run After Restart <a name="chapter-7"></a>: 
This is very easy to do, simply change directory into the cloned folder above and run this command 
```bash
python3 main.py
``` 
and that's it, it will boot up and start automating. Enjoy!

<hr/><br/>

### 8. Error Logs <a name="chapter-8"></a>: 
Great!, you are all done and probably smiling at your twitter timeline and followers updating <b>automagically</b>. Anyway if you have or faced any issues following the steps above that you cannot fix, no worries, e-mail <a href="mailto:jeff@jefferyclonne.com">me</a> or visit [my website](http://jefferyclonne.com) and please remember to be thorough in telling me exactly what went wrong, thanks for your time, Happy Automating!

<hr/><br/>
### Code Repo: {% github Open-Clonne/scripts %}