GithubHelp home page GithubHelp logo

shc261392 / twitter-bot-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 19 KB

A minimum example for how to run a Python Twitter bot to tweet automatically.

License: GNU General Public License v3.0

Shell 1.66% Python 98.34%

twitter-bot-example's Introduction

twitter-bot-example

A minimum example for how to run a Python Twitter bot to tweet automatically.

Quickstart

  1. Get a Twitter account
  2. Go to Twitter Dev Dashboard
    1. Create an App and enter the App name (bot name)
    2. Save the API Key and API Secret Key to somewhere safe
    3. Click App Settings
    4. Click Keys and Tokens tab
    5. Click the Generate button in Access Token and Secret section
    6. Save the Access token and Access token secret to somewhere safe
  3. Clone the twitter-bot-example
$ git clone [email protected]:shc261392/twitter-bot-example.git
$ cd twitter-bot-example
  1. Create your .env file by
$ cp .env.example .env
  1. Fill the .env file with your saved keys. For example, if your API key is 111111, your API secret key is 222222, your Access token is 333333, your Access token secret is 444444, it should look like this:
CONSUMER_KEY=111111
CONSUMER_SECRET=222222
ACCESS_TOKEN=333333
ACCESS_TOKEN_SECRET=444444
  1. Create and activate a virtual environment
$ python3 -m venv venv
$ source venv/bin/activate
  1. Install dependencies and install the package in editable mode
(venv)$ python3 -m pip install -e .
  1. You can now try to tweet with the bot

Tweet (text only)

(venv)$ simple_tweet -t 'This is the content of tweet'

Tweet (text and image)

(venv)$ simple_tweet -t 'This is a tweet with image' -m https://d1e00ek4ebabms.cloudfront.net/production/846fa298-c016-465f-b73e-0591df79ec98.png

Random tweet chosen from data/tweet_contents.json

(venv)$ random_tweet

Random tweet chosen from data/tweet_contents.json, scheduled to tweet on all times listed in data/schedule.txt

(venv)$ scheduled_random_tweet

twitter-bot-example's People

Contributors

shc261392 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.