#! /usr/bin/env pythonimportosimporttimeimporttweepyfromdidyoumean3.didyoumeanimportdid_you_meanfromtweepyimportCursorclassTweeper(object):def__init__(self,name:str):auth=tweepy.OAuthHandler(os.environ["ZOO_DAWA_KEY"],os.environ["ZOO_DAWA_KEY_SECRET"])auth.set_access_token(os.environ["ZOO_DAWA_TOKEN"],os.environ["ZOO_DAWA_TOKEN_SECRET"])self.api=tweepy.API(auth)self.name=name@propertydefall_tweets(self):return[t.textfortinCursor(self.api.user_timeline,id=self.name).items()]deftweet(self,message,wait_delay=5,prevent_duplicate=True):"""Tweets a message after spellchecking it."""ifprevent_duplicateandmessageinself.all_tweets:print("Was already tweeted: %s."%message)else:message=did_you_mean(message)print("About to tweet:",message)time.sleep(wait_delay)self.api.update_status(message)