An bot that help users to response to their favorite authors' tweets. It spread smile and love on Twitter. It's a nice bot!
โ Python 3.7 with the following 3rd party library dependency:
- flask (for the advance use only)
- tweepy
- yaml
- Apply for a Twitter Developer account and create a Twitter App project. Get the API key and API secret key from the project page (follow the steps here), then add those information into
config.yaml
. - Let's say you want to use the current developer account to response to other people. In this case, you can generate access token and access token secret for your current account in the same page you just generate API key and API secret key. Generate access token and access token secret and add them to
token_db.csv
in the format of{access token},{access token secret}
; one account authorization in a line. - Add the twitter accounts which your want to response to their tweets into
config.yaml
. Copy the @username (name after "@", e.g., realDonaldTrump for Donald Trump) and put it in the list calledtrack_uid
. - Response to the tweets automatically with
Responser
scripts by simply execute the followingResponser
script in command line.retweet.py
: retweet newest 10 tweets post bytrack_uid
using the accunt authorizaiton intoken_db.csv
.
This library comes with a flask
script that help you to collect user authorization (i.e., access token and access token secret) from users using web interface. To use this flask script, do the following:
- Deploy the
token_collect.py
to web server, then add the information of the protocol (e.g.: http/https), ip/domain name, and port intoconfig.yaml
. - Determine the API endpoint which Twitter will respond to the endpoint with user's authorization information after user has authorized your Twitter app. Set this endpoint as
token_endpoint
inconfig.yaml
, and add the full endpoint URL to your Twitter API as theCallback URL
- Determine the API endpoint which user will access to it and start to make authorization. Set this endpoint as
auth_endpoint
inconfig.yaml
. - That's all! Send the full
auth_endpoint
URL to your user. When user access toauth_endpoint
, browser will first redirect users to Twitter to make the authorization, then redirect them back to yourtoken_endpoint
.tocken_collect.py
script will automatically write the authorization information into a local filetoken_db.csv
.