2015-03-18 20:33:43 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import HTMLParser, tweepy, os, sqlite3, time
|
|
|
|
|
|
|
|
# Notice: You may want to create seperate apps (or even accounts) for
|
|
|
|
# the getter and the tweeter.
|
|
|
|
|
|
|
|
# For larger user bases, consider using multiple tweeter accounts.
|
|
|
|
|
|
|
|
cke = "Consumer Key"
|
|
|
|
cse = "Consumer Secret"
|
|
|
|
ato = "Access Token"
|
|
|
|
ase = "Access Secret"
|
|
|
|
|
|
|
|
database_filename = "Database.db"
|
|
|
|
|
|
|
|
auth = tweepy.OAuthHandler(cke, cse)
|
|
|
|
auth.set_access_token(ato, ase)
|
|
|
|
api = tweepy.API(auth)
|
|
|
|
|
|
|
|
sql_conn = sqlite3.connect(database_filename)
|
|
|
|
cur = sql_conn.cursor()
|
|
|
|
|
|
|
|
while True:
|
2015-03-18 22:41:33 +00:00
|
|
|
values = cur.execute("SELECT * FROM tweets WHERE datetime(timestamp) < datetime('now','localtime') AND sent = 0")
|
2015-03-18 20:33:43 +00:00
|
|
|
for status in values:
|
2015-03-18 20:48:26 +00:00
|
|
|
original = int(status[0])
|
2015-03-18 20:33:43 +00:00
|
|
|
recipient = status[2]
|
|
|
|
comment = status[3]
|
2015-03-18 20:48:26 +00:00
|
|
|
try:
|
|
|
|
api.update_status("@%s Es wär soweit... :)" % recipient, original)
|
2015-03-18 21:42:54 +00:00
|
|
|
cur.execute("UPDATE tweets SET sent = 1 WHERE tweet_id = %i" % original)
|
2015-03-18 21:50:03 +00:00
|
|
|
sql_conn.commit()
|
2015-03-18 20:48:26 +00:00
|
|
|
except:
|
|
|
|
pass
|
2015-03-18 20:33:43 +00:00
|
|
|
|
|
|
|
time.sleep(10)
|