Chapter 8. Automated Tasks
kmakice Look Ma, no hands! Find out how to make your applications run by themselves.
The suite of sample applications is almost complete. In Chapter 6 you saw how to set up the environment in which the tools function, and in Chapter 7 you got a tour of the web interfaces users will see when they interact with the tools. This chapter examines the code used to run the behind-the-scenes operations that give the tools their functionality.
Automated tasks run in the background at scheduled intervals to perform work without user oversight. They draw from what has been saved in the database through the web interfaces and what they have collected through the Twitter API. Servers manage the launching of these applications using commands set in a crontab file. For details on how to set up an automated task, see A Place to Call /home.
There are five automated tasks that power the suite of sample applications:
- RSS to Tweet
This script asks the database for a list of all the RSS or Atom URIs that Twitter members have registered through the Auto Tweet tool, as well as for each user’s authentication information, to form a queue of news feeds to turn into tweets. The stored credentials are checked against the Twitter API to make sure they work, and the feeds of any members whose credentials do not validate are disabled from future processing. Each remaining feed is then retrieved ...
Get Twitter API: Up and Running now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.