parrot

Read Twitter’s API tokens.

import configparser

config = configparser.ConfigParser()
config.read("../../../../python/python-experiments/twitter.tokens")

api_key = config["secrets"]["api_key"]
api_secret = config["secrets"]["api_secret"]
consumer_token = config["secrets"]["consumer_token"]
consumer_secret = config["secrets"]["consumer_secret"]

Build the API object.

import tweepy

auth = tweepy.OAuthHandler(api_key, api_secret)
auth.set_access_token(consumer_token, consumer_secret)

api = tweepy.API(auth)

Build the Parrot class.

import parrot as p

parrot = p.Parrot(api=api)

Get my own tweets and train the model.

parrot.train_user(username="ruimvieira", number=2000)

Generate 20 fake tweets.

tweets = parrot.generate(20)
for tweet in tweets:
    print(tweet)
@otomojamjam @tusk_music #tuskfestival https://t.co/joUu2dJ1SE.
Google+ is the 5 year old with a keyboard is the 5 year old bottle of Worcestershire sauce in the MOC #redhat ⁦@devconf_us⁩ #defineFUTURE https://t.co/yIFNxlrVNL.
This seems to be… https://t.co/IKR10se38U.
@dumpsternaut @mycoliza Yes, but if you don't really r… https://t.co/DXMWJT1i7v.
Looking forward to speak about streaming recommendation engines at @berlinbuzzwords, June 2018.… https://t.co/4OxGcjtas0. https://t.co/6uP8MjSBfl.
A type of fairground distorting mirror where you don't provide much info, it will just load whatever is available under that… https://t.co/C5Rshhgbyv.
@TorturingNurse thanks for the #tuskfestival report @tusk_music https://t.co/bSFQLOJquG.
Craig Leon #tuskfestival @tusk_music @BrothersHameed https://t.co/qZXWz2OXJd.
Weekend contrite lessons: setting up multiple accounts on Twitter and building your own social media data is hilarious.
. The discussion seems to have disappeared from “prefere… https://t.co/sbXxUXThy0.
So absorbed into Terry Riley almost forget a photo for the always great @willb at @DataSphere_conf #DataSphere #Krakow https://t.co/aoxQmGpPgL. waiting for the follow.
Looking forward to speak about streaming recommendation engines at @berlinbuzzwords, June 2018.… https://t.co/4OxGcjtas0. https://t.co/6uP8MjSBfl.
A one year old bottle of Worcestershire sauce in the back of the Tusk-mini gig in 2014!
CodeReady Containers is awesome. https://t.co/1qpN9PX2fY.
@dumpsternaut @mycoliza Yes, but if you specify the path.
I have great memories of the cupboard that you completely forgot about..
The option seems to work like describe… https://t.co/kBhpnffkvD.
Google+ is the 5 year old with a keyboard is the 5 year old with a keyboard is the 5 year old bottle of Worcestershire sauce in the back of the Tusk-mini gig in 2014!
I'll be talking about Istio on #Kubernetes ⁦@devconf_us⁩ #defineFUTURE #Boston https://t.co/dfUWwhSISn.
@TorturingNurse thanks for the always great @willb at @DataSphere_conf #DataSphere #Krakow https://t.co/aoxQmGpPgL. waiting for the #tuskfestival report @tusk_music https://t.co/bSFQLOJquG.