def get(self): auth = BasicAuthHandler("user", "password") api = API(auth, source="3990552168") timeline = api.user_timeline(count=1, page=1)[0] tweet = Tweet.all().get() if not tweet: tweet = Tweet(text=timeline.text, date=timeline.created_at) tweet.text = timeline.text tweet.date = timeline.created_at tweet.put()
def post(self): # Save new text of twitter-bot new_tweet = Tweet(text = self.request.get("text")) new_tweet.put() self.redirect("/")