From 249a8102f2db19cc97b3e8f9a319d1ae93d891fe Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Thu, 19 Mar 2015 18:44:12 +0100 Subject: [PATCH] Add handling of past dates --- getter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/getter.py b/getter.py index e314e58..24de8cc 100755 --- a/getter.py +++ b/getter.py @@ -31,7 +31,7 @@ while True: timeline = tweepy.Cursor(api.search, q=search, since_id=savepoint).items() for status in timeline: - text = status.text.encode("UTF-8") + text = status.text.decode("UTF-8") sender = status.user.screen_name.encode("UTF-8") twid = int(status.id) if "storn" in text.lower(): @@ -54,7 +54,10 @@ while True: if date < datetime.datetime.now(): if date.date() == datetime.datetime.now().date(): - date += datetime.timedelta(days = 1) + if (not date == datetime.datetime.now().replace(hour = 0, minute = 0, second = 0, microsecond = 0)) or "0:0" in text: + date += datetime.timedelta(days = 1) + else: + continue else: api.update_status("@%s Das war doch schon...?" % sender, twid) continue