Skip to content

Latest commit

 

History

History

inpycon-twitterbot

inpycon-twitterbot

Open Source Love PyPI - Python Version License: MIT

A twitter bot made using Python and Twitter API to retweet posts using specific terms related to the conference and be beneficial to thea social media campaign by keeping all tweets about PyCon India in one place and get the event trending. It could be hastags, twitter handles, slang words. Anything.

Setup and Running the bot

Install the Requirements

  • Fork and clone this repository,
git clone <Forked repository URL>
  • Run the following command in your terminal, be sure to have Python3 already setup in your system.
pip3 install -r requirements.txt --user 

Creating Twitter API Credentials

  1. Go to the https://apps.twitter.com/
  2. Click the Create App button
  3. Fill the necessary details for your application that you are creating
    • Name of the bot
    • Website name
    • Description
  4. Once created, goto Keys and Tokens section and generate your access tokens.

Configuring Tweepy API

  • For the bot to run, the Tweepy API needs to be authorised with Consumer keys, access tokens etc. These values are listed in scripts/config.py and needs to be filled before the execution of main.py script.

  • Add hashtags, specific words, user handles in the searchterms list. Anything you want retweeted.

Running the Bot

  • Navigate to the scripts directory and run the bot using the following command
  python3 main.py

Hosting on Heroku

Use the following commands to host this app in heroku

heroku create
git add .
git commit -m "initial commit"
git push heroku master
heroku ps:scale worker=1
heroku logs --tail

Contribution and Licence

Refer to the Contributing.md for the same. The source code is under MIT License.