Coo is an easy to use Python library for scheduling Twitter updates.
Based on the "RESTful API" category.
Alternatively, view coo alternatives based on common mentions on social networks and blogs.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of coo or a related project?
coo: schedule Twitter updates with easy
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 the Twitter Developers Platform and generate the Keys and Access Tokens.
pip install coo
Initializing
from coo import Coo
at = Coo(
"consumer_key",
"consumer_secret",
"access_token",
"access_token_secret",
preview=False
)
Alternatively, you can set preview=True and print your tweets in the terminal instead to post them on Twitter.
Scheduling Twitter updates:
from coo import Coo
at = Coo(
"consumer_key",
"consumer_secret",
"access_token",
"access_token_secret"
)
tweets = [
("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, "Awesome Twitter update without a template."),
]
at.schedule(tweets, time_zone="America/Santiago")
Or you can use a list of strings and add a delay, interval and a template:
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)
For more detailed options and usage, keep reading or check the documentation :blue_book:.
Schedule updates with datetime strings or integers and use custom templates if needed.
Coo.schedule(updates, time_zone, media)
Full example:
from coo import Coo
at = 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, "Awesome 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")
local.ScheduleError is raised.Here you can find all the Time Zones available.
There 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")
Post ordered updates with delay, interval, and a template if needed.
Coo.tweet(updates, delay, interval, template, media, time_zone, aleatory)
from coo import Coo
at = 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 updates
at.tweet(tweets)
You can use datetime, date and time strings, integers as seconds and some strings as keywords: half_hour, one_hour, one_day and one_week between others to delay the post of your first update.
# datetime, date and time strings
at.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")
# integer
at.tweet(tweets, delay=604800)
Remember to read the Notes for parsing DateTime strings.
Use integers as seconds or some strings as keywords: half_hour, one_hour, one_day and one_week between others.
# "keywords"
at.tweet(tweets, interval="four_hours")
# integers
at.tweet(tweets, interval=14400)
And of course, you can also set one template for each one of the updates.
at.tweet(tweets, template=template)
Use one media file for all of your updates:
at.tweet(tweets, media="path/to/media.jpeg")
To tweet your updates randomly:
at.tweet(tweets, aleatory=True)
| Keyword | Seconds |
|---|---|
| now | 0 |
| half_hour | 1800 |
| one_hour | 3600 |
| two_hours | 7200 |
| four_hours | 14400 |
| six_hours | 21600 |
| eight_hours | 28800 |
| ten_hours | 36000 |
| twelve_hours | 43200 |
| fourteen_hours | 50400 |
| sixteen_hours | 57600 |
| eighteen_hours | 64800 |
| twenty_hours | 72000 |
| twenty_two_hours | 79200 |
| one_day | 86400 |
| two_days | 172800 |
| three_days | 259200 |
| four_days | 345600 |
| five_days | 432000 |
| six_days | 518400 |
| one_week | 604800 |
Templates are very simple, just use a multiline string and add a $message where you want your message to appear.
template = """My awesome header
$message
#python #coding #coo
"""
Coo is written using the Python Twitter wrapper, and through Coo.api you gain access to all of his models:
# get your followers
followers = at.api.GetFollowers()
# get your direct messages
d_messages = at.api.GetDirectMessages()
# favorited tweets
favorites = at.api.GetFavorites()
# mentions
mentions = at.api.GetMentions()
# retweets
retweets = at.api.GetRetweets()
And a lot more. If you are interested, check their documentation.
Coo.schedule..toml files for configuration and tweets.Documentation available at coo.readthedocs.io.
*Note that all licence references and agreements mentioned in the coo README section above
are relevant to that project's source code only.
Do not miss the trending, packages, news and articles with our weekly report.