コード例 #1
0
__author__ = 'd3non'

from c3daysleft import sleep, twitter, get_teweet, get_format
from c3daysleft import SLEEP_MAX, SLEEP_MIN, OAUTH_FILE

import bot_apikeys

if __name__ == "__main__":
    sleep(SLEEP_MIN, SLEEP_MAX)
    oauth = twitter.read_token_file(OAUTH_FILE)
    t = twitter.Twitter(
        auth=twitter.OAuth(oauth[0], oauth[1], bot_apikeys.CONSUMER_KEY,
                           bot_apikeys.CONSUMER_SECRET))
    text = get_teweet().format(**get_format())
    print("tweeting: %s" % text)
    t.statuses.update(status=text)
コード例 #2
0
 def test_get_format_day3(self):
     date = datetime.date(2014, 12, 29)
     format_map = get_format(nextC3date=get_nextC3date(date), date=date)
     self.assertEqual(format_map,
                      {'days_left': -2, 'nextC3': '31C3', 'nextC3_date': datetime.date(2014, 12, 27)})
コード例 #3
0
 def test_get_format_day5(self):
     date = datetime.date(2014, 12, 31)
     format_map = get_format(nextC3date=get_nextC3date(date), date=date)
     self.assertEqual(format_map,
                      {'days_left': 361, 'nextC3': '32C3', 'nextC3_date': datetime.date(2015, 12, 27)})
コード例 #4
0
__author__ = 'd3non'

from c3daysleft import sleep, twitter, get_teweet, get_format
from c3daysleft import SLEEP_MAX, SLEEP_MIN, OAUTH_FILE

import bot_apikeys


if __name__ == "__main__":
    sleep(SLEEP_MIN, SLEEP_MAX)
    oauth = twitter.read_token_file(OAUTH_FILE)
    t = twitter.Twitter(auth=twitter.OAuth(oauth[0], oauth[1], bot_apikeys.CONSUMER_KEY, bot_apikeys.CONSUMER_SECRET))
    text = get_teweet().format(**get_format())
    print("tweeting: %s" % text)
    t.statuses.update(status=text)