Skip to main content

A library built on top of Tweepy for making Twitter bots

Project description

Tweepy Parrot

A library built on top of Tweepy, designed to auto generate tweets from data sourced from other users.

A bot made with this library, will stream unique tweets and retweets of the users it follows and/or is followed by. It cleans and parses the words from the tweet into a growing Markov chain, which is later used to generate tweets.

Setup


pip install tweepy-parrot

To setup the bot, you must setup a Twitter developer account, and then either add the following to a .env file in your project, or otherwise export them to the runtime environment.

TWITTER_API_KEY={YOUR_API_KEY}
TWITTER_API_SECRET={YOUR_API_SECRET}
TWITTER_ACCESS_TOKEN={BOT_ACCESS_TOKEN}
TWITTER_ACCESS_SECRET={BOT_ACCESS_SECRET}

Once done, you are ready to use the library.

Examples


A simple example that will store data in a JSON format, and echo Squawks to your terminal, rather than Tweet them out.

from time import sleep

from tweepy_parrot import JSONParrot, ParrotBot

my_parrot = JSONParrot('parrot.json')
my_bot = ParrotBot(my_parrot)

# Call start, to being listening to the data stream.
# follows=True will stream data from accounts the bot follows
# followers=True will stream data from accounts that follow the bot
my_bot.start(follows=False, followers=True)

while True:
    sleep(3600)  # One hour
    print(my_bot.squawk(post=False))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tweepy-parrot-0.0.3.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

tweepy_parrot-0.0.3-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page