TITLE :- Twitter Bot
DESCRIPTION :- Scripts to fetch twitter data using Twitter API
ABOUT THE PROJECT :-
In this project we are going to build bots using twitter API. We will be building 4 twitter bots.
-
1_MyInfo.py -> This bot fetches my info such as username, screenname, no.of followers, public tweets from my home page.
-
2_FollowBack.py -> This bot automatically follows back all my followers.
-
3_KeywordLike.py -> This bot favorites the given number of tweets of a given keyword. For ex. if keyword = 'python' and no. of tweets = 5, then it will favorite the first 5 tweets which has the word python.
-
4_Favorite.py -> This bot favorites the given number of tweets of a given follower name.
Twitter API :-
- Need to have Twitter account.
- Twitter API is a permissive API.
- Twitter is very cautious when it comes to people creating spam bots.
- Therefore, one needs to apply to get access to their API (IT'S FREE).
SETTING UP AN ACCOUNT :-
- Go to link https://developer.twitter.com/en
- Login using your twitter username and password.
- Click on apply
- Choose any one for ex:-student.
- Verify and click next.
- fill in the details and click next.
- How will you use the twitter API or Twitter Data -- be genuine and ethical and write that you want to use it for learning purpose and exploring api and so on.
- verify and submit application
- It will usually take a day or two, or sometimes more, for your application to be reviewed by Twitter.
- Results will be se nt through email.
CREATING AN APP :-
- Goto developer twitter account and click on Projects & Apps.
- Click on Create App and name your app then click on complete.
- You will get you API Key(consumer_key), API Secret Key(consumer_secret) and Bearer Token, copy them and save it seperatly.
- Click on your app name.
- Goto app details and then click on Keys & Tokens Tab.
- You can find all your keys here.
- In the Access Token & Secret session click on generate button.
- Again save the keys along with rest of the keys.
THE REQUIRED TOOLS :-
-
Tweepy Module : An easy-to-use Python library for accessing the Twitter API.
pip install tweepy -
CSV Module :-
-
The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases.
-
The csv module implements classes to read and write tabular data in CSV format.
-
The CSV Module is a built in module.
-