Python Twitter Bot

Just created a twitter bot with python and tweepy (a python library to interact with twitter, http://www.tweepy.org/) which is following a defined set of users. This users are gathered from defined user’s followers. After a defined lease of days this followers are became unfollowed if they did not followed back during a new execution of the script.

This script also handles the max API calls per execution. –> normally the max limit is set to 300/15min.
All data will be stored and updated in a local CSV.

Basic steps:

1. Create an twitter application and describe the purpose and details. (https://developer.twitter.com/en/apps/)

App Name: Choose a unique name
Description: Description of your application
Sign in with Twitter: Enabled
Callback URL: http://127.0.0.1
App usage: Purpose and description of your application

2. Get the Keys and Tokens

Get the API keys from tab: “Keys and tokens” and store them in a different file

3. Explore basic functions and API docs

Tweepy docs: http://docs.tweepy.org/en/v3.5.0/

Authentication

Create a Tweet

Delete a Tweet

Follow

Unfollow

Structure of CSV:

Python script:

4 months ago

Leave a Reply

Your email address will not be published. Required fields are marked *