Giter Club home page Giter Club logo

twitter_responser's Introduction

Twitter Responser Bot

An bot that help users to response to their favorite authors' tweets. It spread smile and love on Twitter. It's a nice bot!

Environment

โ€‹ Python 3.7 with the following 3rd party library dependency:

  • flask (for the advance use only)
  • tweepy
  • yaml

Usage

  1. 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.
  2. 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.
  3. 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 called track_uid.
  4. Response to the tweets automatically with Responserscripts by simply execute the following Responser script in command line.
    • retweet.py: retweet newest 10 tweets post by track_uid using the accunt authorizaiton in token_db.csv.

Advance Use: collect user authorization through the web

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:

  1. Deploy the token_collect.py to web server, then add the information of the protocol (e.g.: http/https), ip/domain name, and port into config.yaml.
  2. 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 in config.yaml, and add the full endpoint URL to your Twitter API as the Callback URL
  3. Determine the API endpoint which user will access to it and start to make authorization. Set this endpoint as auth_endpoint in config.yaml.
  4. That's all! Send the full auth_endpoint URL to your user. When user access to auth_endpoint, browser will first redirect users to Twitter to make the authorization, then redirect them back to your token_endpoint. tocken_collect.py script will automatically write the authorization information into a local file token_db.csv.

twitter_responser's People

Contributors

kimballxd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.