Package: coo
Coo is an easy to use Python library for scheduling Twitter updates. To use it, you need
to first apply for a developer account in theTwitter Developers Platformand generate the Keys and
Access Tokens.pipinstallcooInitializingfromcooimportCooat=Coo("consumer_key","consumer_secret","access_token","access_token_secret",preview=False,)Alternatively, you can setpreview=Trueand print your tweets in the terminal instead
to post them on Twitter.Scheduling Twitter updates:fromcooimportCooat=Coo("consumer_key","consumer_secret","access_token","access_token_secret")tweets=[("2030-12-05 16:30",template,"Awesome Twitter update."),("2030-10-28 18:50",template,"Another awesome Twitter update."),("2030-10-29 18:15",template2,"One more update."),("2030-11-01 13:45",None,"Twitter update without a template."),at.schedule(tweets,time_zone="America/Santiago")Or you can use a list of strings and add adelay,intervaland atemplate:tweets=["My first awesome Twitter Update","My second awesome Twitter Update","My third awesome Twitter Update","My fourth awesome Twitter Update","My fifth awesome Twitter Update","My sixth awesome Twitter Update",]at.tweet(tweets,delay="13:45",interval="four_hours",template=my_template)Schedule Twitter UpdatesSchedule updates withdatetimestrings or integers and use custom aTemplateif needed.Coo.schedule(updates,time_zone)Full example:fromcooimportCooat=Coo("consumer_key","consumer_secret","access_token","access_token_secret")tweets=[# datetime with and without templates("2030-10-28 18:50",template,"My Twitter update with a template."),("2030-10-29 18:15",template2,"Update with a different template."),("2030-11-01 13:45",None,"Twitter update without a template."),# date with and without templates("2030-12-25",template3,"Merry christmas!"),("2031-01-01",None,"And a happy new year!"),# time with and without templates("18:46",template2,"Will be post today at 18:46."),("23:00",None,"A tweet for today at 23:00."),# integer (seconds) with and without templates(3600,template,"This tweet will be posted in an hour."),(86400,None,"This one, tomorrow at the same hour."),]at.schedule(tweets,time_zone="America/Santiago")Parsing DateTime stringsIf a time zone is not specified, it will set tolocal.The time will be set to 00:00:00 if it’s not specified.When passing only time information the date will default to today.A future date is needed, otherwise aScheduleErroris raised.Here you can find all theTime Zones.Media FilesThere are two ways to add media files to your tweets. The first and easiest is to use one global file for all the updates:at.schedule(tweets,time_zone="America/Santiago",media="path/to/file.png")Also, an individual file can be set for each one of the updates:tweets=[("2030-10-28 18:50",template,"Update with an image.","pics/owl.png"),("2030-10-29 18:15",template,"Update with other media.","videos/funny_video.mp4"),("2030-11-01 13:45",template,"Tweet without media."),]Finally, it is possible to combine these to ways. For example, if most of the tweets are gonna use the same media and just a few will have a different or none:tweets=[("2030-11-01 13:45",template,"Tweet with global media."),("2030-11-02 13:45",template,"Tweet with global media."),("2030-11-03 13:45",template,"Tweet with global media."),("2030-11-04 13:45",template,"Tweet with global media."),("2030-11-05 13:45",template,"Tweet with global media."),("2030-11-06 13:45",template,"Tweet with global media."),("2030-11-07 13:45",template,"Tweet with global media."),("2030-11-08 13:45",template,"Tweet without media.",None),("2030-11-09 13:45",template,"Tweet without media.",None),("2030-12-10 18:50",template,"Update with an image.","pics/owl.png"),("2030-12-11 18:15",template,"Update with other media.","videos/funny_video.mp4"),]at.schedule(tweets,time_zone="America/Santiago",media="path/to/global_media.png")Tweet an ordered list of stringsPost ordered updates withDelay,Interval, and aTemplateif needed.Coo.tweet(updates,delay,interval,template,time_zone)fromcooimportCooat=Coo("consumer_key","consumer_secret","access_token","access_token_secret")tweets=["My first awesome Twitter Update","My second awesome Twitter Update","My third awesome Twitter Update","My fourth awesome Twitter Update","My fifth awesome Twitter Update","My sixth awesome Twitter Update",]# post the twitter updatesat.tweet(tweets)DelayYou can usedatetime,dateandtimestrings, integers as seconds and someKeywords:half_hour,one_hour,one_dayandone_weekbetween others to
delay the post of your first update.# datetime, date and time stringsat.tweet(tweets,delay="2030-11-24 13:45",time_zone="America/Santiago")at.tweet(tweets,delay="2030-11-24",time_zone="Australia/Sydney")at.tweet(tweets,delay="13:45",time_zone="America/New_York")# "keywords"at.tweet(tweets,delay="one_week")# integerat.tweet(tweets,delay=604800)When parsing DateTime strings:If a time zone is not specified, it will set tolocal.The time will be set to 00:00:00 if it’s not specified.When passing only time information the date will default to today.A future date is needed, otherwise aScheduleErroris raised.Here you can find all theTime Zones.IntervalUse integers as seconds or some strings asKeywords:half_hour,one_hour,one_dayandone_weekbetween others.# "keywords"at.tweet(tweets,interval="four_hours")# integersat.tweet(tweets,interval=14400)Media filesUse one media file for all of your updates:at.tweet(tweets,media="path/to/media.jpeg")Random updatesTo tweet your updates randomly:at.tweet(tweets,aleatory=True)KeywordsKeywordSecondsnow0half_hour1800one_hour3600two_hours7200four_hours14400six_hours21600eight_hours28800ten_hours36000twelve_hours43200fourteen_hours50400sixteen_hours57600eighteen_hours64800twenty_hours72000twenty_two_hours79200one_day86400two_days172800three_days259200four_days345600five_days432000six_days518400one_week604800TemplateTemplates are very simple, just use a multiline string and add a$messagewhere you want your message to appear.template="""My awesome header

$message

#python #coding #coo
"""The Twitter APICoo is written using thePython Twitterwrapper, and throughCoo.apiyou gain access to all of his models:# get your followersfollowers=at.api.GetFollowers()# get your direct messagesd_messages=at.api.GetDirectMessages()# favorited tweetsfavorites=at.api.GetFavorites()# mentionsmentions=at.api.GetMentions()# retweetsretweets=at.api.GetRetweets()And a lot more. If you are interested, check theirdocumentation.DocumentationDocumentation available atreadthedocs.org.