db2twitter automatically extracts fields from your database, use them to feed a template of tweet and send the tweet.
db2twitter is developed by and run for LinuxJobs.fr, the job board of th french-speaking Free Software and Opensource community.
- Github of db2twitter (star it if you like đ
- Official documentation on readthedocs
Imagine you want to send tweets like this sentence : MyTux hires a #Django developer https://www.mytux.fr/jobs/36
Let’s say you have a MySQL database with a database “mytuxjobs”, a table “jobs” and fields “title” and “url”
db2twitter will need the following informations:
dbhost=localhost database=mytuxjobs dbuser=mytuxjobs dbpass=V3rYs3cr3t! dbtables=jobs, jobs_rows=title,id
Lets define a template for our tweet:
tweet=MyTux hires a {} https://www.mytux.fr/jobs/{}"
db2twitter will get data from the database, builds a tweet filling the wildcard of the tweet template with the data from the database, and send the tweet. By default the last row in the given table is used. Cool isn’t it?
db2twitter is coded in Python 3.4, uses SQlAlchemy (see supported database types) and Tweepy. The official documentation is available on readthedocs.
One thought on “db2twitter: get data in database, build and send tweets”