Example #1
0
    def get(self):
        weather = Weather(130010)
        telop = weather.get_telop()

        if telop.find(u'雨') != -1:
            msg_tmpl = u'おはようございます。今日は{0}ですね。傘はお持ちですか? {1}'
            msg = msg_tmpl.format(telop, weather.get_link())
        elif telop.find(u'雪') != -1:
            msg_tmpl = u'おはようございます。今日は{0}ですよ! 暖かくしていってくださいね。 {1}'
            msg = msg_tmpl.format(telop, weather.get_link())
        else:
            r = random.randint(0, 2)

            if r == 0:
                msg = u'おはようございます。今日も1日がんばりましょう。'
            elif r == 1:
                msg = u'おはようございます。今日は何しようかな?'
            elif r == 2:
                msg = u'おはようございまーす♪'

        account = Account()
        account.tweet(msg)
Example #2
0
    def get(self):
        weather = Weather(130010)
        telop = weather.get_telop()

        if telop.find(u'雨') != -1:
            msg_tmpl = u'おはようございます。今日は{0}ですね。傘はお持ちですか? {1}'
            msg = msg_tmpl.format(telop, weather.get_link())
        elif telop.find(u'雪') != -1:
            msg_tmpl = u'おはようございます。今日は{0}ですよ! 暖かくしていってくださいね。 {1}'
            msg = msg_tmpl.format(telop, weather.get_link())
        else:
            r = random.randint(0, 2)

            if r == 0:
                msg = u'おはようございます。今日も1日がんばりましょう。'
            elif r == 1:
                msg = u'おはようございます。今日は何しようかな?'
            elif r == 2:
                msg = u'おはようございまーす♪'

        account = Account()
        account.tweet(msg)
Example #3
0
 def test_get_telop(self):
     weather = Weather(130010)
     print weather.get_telop()