First version of the tweeter. Needless to say it's untested.
This commit is contained in:
parent
3887bbb03d
commit
8f9c64b6ad
1 changed files with 33 additions and 0 deletions
33
tweeter.py
Executable file
33
tweeter.py
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/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:
|
||||
values = cur.execute("SELECT * FROM tweets WHERE timestamp < datetime('now')")
|
||||
for status in values:
|
||||
original = status[0]
|
||||
recipient = status[2]
|
||||
comment = status[3]
|
||||
api.update_status("@%s Es wär soweit... :)" % sender, twid)
|
||||
|
||||
time.sleep(10)
|
Loading…
Reference in a new issue