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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file tweepy-parrot-0.0.3.tar.gz.

File metadata

  • Download URL: tweepy-parrot-0.0.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.7

File hashes

Hashes for tweepy-parrot-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3084963c34429a7594c38e9dfb6ef2b0758ce43d911a03c9411fc51bc52692cf
MD5 9d6ee07d705f9ea4ddefafadd08c7611
BLAKE2b-256 9cb9e6cd5796e861e42464d6483d0ac6f66dc6d35a2c53d760b865edaa3a7229

See more details on using hashes here.

File details

Details for the file tweepy_parrot-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: tweepy_parrot-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.7

File hashes

Hashes for tweepy_parrot-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f9876140cc5dc4b0fcb0e096f0a45c3febb1a774fc0257665388ed95fd02c835
MD5 82fee69d4bdac0d8c716e87dd07e7249
BLAKE2b-256 4c7194be33ee783a4e211900508aa05bb78557c2d5be3d377aaeef18749e9e95

See more details on using hashes here.

Supported by

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