def get(self): logging.info('adding user') tsn = self.request.get('tsn') mun = self.request.get('mun') mpw = self.request.get('mpw') mid = self.request.get('mid') tz = self.request.get('tz') user = TwixiUser(twitter_screen_name=tsn, mixi_username=mun, mixi_password=mpw, mixi_memberid=mid, timezone=tz) user.put() self.response.out.write('OK\n')
def get(self, screen_name): query = TwixiUser.all() user = query.filter('twitter_screen_name =', screen_name).get() if user is None: self.error(500) logging.error("No user with twitter screen name %s" % screen_name) return tweets = self.newTweets(user, 'atom') logging.debug(tweets) if not tweets or len(tweets) == 0: self.response.out.write('No new tweets\n') return (title, body) = self.prettyFormat(tweets, user) logging.debug(title) logging.debug(body) if not body: self.response.out.write('Nothing to post\n') return service = mixi.Service(user.mixi_username, twixi.Decrypt(user.mixi_password), user.mixi_memberid) entry = mixi.DiaryEntry(title, body) (response, rbody) = service.postDiary(entry); self.response.set_status(response.status, response.reason.encode('utf-8')) self.response.out.write(rbody)