Пример #1
0
    def post(self, timestamp):
        dirty = json.loads(self.request.body)
        logging.info("updated: {0}".format(json.dumps([f["real_name"] for f in dirty["updated"]])))

        identifier = auth.get_int("identifier", self.request)
        device = model.Device.get_by_id(identifier)
        if device:
            self.update_friends(device.account, dirty)
            self.get_friends(device.account, timestamp, datetime.now())
            deferred.defer(friends_import.fetch_from_lastfm, device.account.key())
Пример #2
0
 def get(self, friend_name):
     identifier = auth.get_int('identifier', self.request)
     device = model.Device.get_by_id(identifier)
     if device:
         friend = device.account.friends.filter('name = ', friend_name).get()
         if friend:
             self.response.headers['Content-Type'] = 'image/jpeg'
             self.response.write(friend.image)
         else:
             logging.error('friend: {0} not found'.format(friend_name))
     else:
         logging.error('user not found')