markovBot is a simple Twitter bot that will generate a sentence using Markov chains and then tweet it.
pip install markovify
pip install tweepy
Fill corpus of example text
This project comes with a copy of Charles Dickens's A Tale of Two Cities as its example corpus.
Lots of good sources are available from Project Gutenberg.
Save the text file as
Test Markov chain
python tweet.py to see an example tweet.
Create a Twitter account.
Sign in to the Apps page and get four pieces of data:
- Consumer Key
- Consumer Secret
- Access Token
- Access Token Secret
And edit the
twitter_credentials.json file with the above four pieces of data.
PUBLISH variable in
True to have the bot post to Twitter.
AWS Lambda (Optional)Deploy to
Steps for setting up auto-tweet account (using OS X or Linux):
- Add PyPI dependencies to
make prepareto generate
- In the AWS console, create a Python 2.7 function with
tweet.send_tweetas the handler. Upload
lambda_bundle.zipto use as the code. Add a "Scheduled Event" event source.