Build a Twitter Analytics App using Python

Build a Twitter Analytics App

1 Introduction: Start Here

2 The First Step: Design Your Solution

3 In Which I Rant a Little

4  Design Solution

5 Writing Great Code

6 Writing the Backend Twitter Server

Writing the Code in Small Parts: Part 1, The Basic App

Part 2: Adding a Counter to Exit

Part 3: Adding Language and Retweet Count

Part 4: Organising Our Code

7 Adding the Data to a Database

8 Testing: What and How to Test

8.1 Testing Our Frontend

8.2 Testing Our Backend

9 Displaying our Data using the Flask Webserver

9.1 Introduction to Flask

9.2 Adding templates to our Flask app

9.3 Displaying our Tweets in the Flask Web Server

10 Future Work and Improvements

Welcome to the Twitter Analyser project, where you will learn how to build a Python / Flask app that will analyse Twitter data in real time.

twitpy1

Unlike other tutorials, I’d like to do this slightly differently. Normal tutorials just give you the code and say Here you go. This is how you do it.

In more and more online forums, I see beginners complaining that they don’t know what to do next, after they have learnt the basics of programming. They are asked to look at the code of big projects, but this often looks intimidating. Or they are told to build their own projects, but again, don’t know where to begin, and so never get started.

In this project, I’d like to do things properly, the way you’d do them if you were on a job, or a paid project.

So we’ll do a design first, write tests, and most importantly, write the code in small chunks. Most projects look complex because you are seeing the end result after months of work. But if you could see the project being built from the ground up, like a building, you’d see it’s just a sum of its parts. We’ll also look at how to break your code down into functions and classes, how to review code and design documents, amongst other things.

Each section of this project will have a bit of theory, and then some exercises for you. The idea is that you develop along with me, so that you learn how to build bigger projects.

If you get stuck, you can look at my solution. Or you can continue with your own.

All the code for this project is available on Github here. We will be developing the code in small parts, and that’s how it is stored in the server.

These are some of the technologies we will use: Python 3, Flask, SqLite, Twitter API, Google Charts (for the graphs).

To get started, make sure you:

1 Have a Twitter developers account.

2 Have a Github account. If you have never used Git before, I have a tutorial for complete beginners. This is not strictly required, but will be useful if you ever want to share your code with others.

Right, to start off, we will first design our solution.

PS: Interested in leveling up your Python and getting a great job? Check out the Python Apprenticeship Program.

 

Leave a Reply