At my last semester at university, I was really struggling with my courses. I was overwhelmed. I thought that “Time just doesn’t pass by”, then

Tutorial: Creating a Twitter (X) Bot using Python

submited by
Style Pass
2024-10-06 21:00:06

At my last semester at university, I was really struggling with my courses. I was overwhelmed. I thought that “Time just doesn’t pass by”, then I came up with a simple project to remind me that time was passing. That’s how I started to build an X bot that tweets the percentage of the semester that has passed. In this article, I will show you how to build a X bot using Python and the X API.

This tutorial is up-to-date as of October 2024 using the new X API. If you are reading this in the future, please check the official documentation for any changes.

I know most of my audience doesn’t speak Turkish, but the tweet simply says that the semester has progressed by 6.61% and there are 88 days left until the end of the semester.

First, you need to create an X account for your bot. Then, you need to sign-in to the X Developer Portal and create a new project. After creating a project, you need to create an app and get the API keys.

Now, copy all of these keys and paste them into a .env file in the root directory of your project. Here is an example of the .env file:

Leave a Comment