Exemple #1
0
 def goodreads_shelf(self, d):
     from services import goodreads
     self.success, readables = goodreads.get_books_on_shelf(
         self.user, shelf='currently-reading')
     if not self.success:
         self.message = "There was a problem - please make sure you've entered your Goodreads ID on the integrations page"
     self.set_response({'readables': [r.json() for r in readables]})
Exemple #2
0
 def get(self):
     from services import pocket, goodreads
     logging.debug("Running SyncReadables cron...")
     TS_KEY = 'pocket_last_timestamp'
     users = User.SyncActive(['pocket', 'goodreads'])
     user_put = []
     for user in users:
         # Pocket
         user_changes = False
         access_token = user.get_integration_prop('pocket_access_token')
         if access_token:
             success, readables, latest_timestamp = pocket.sync(user, access_token)
             logging.debug("Got %d readables from pocket" % len(readables))
             user.set_integration_prop(TS_KEY, latest_timestamp)
             user_changes = True
         success, readables = goodreads.get_books_on_shelf(user, shelf='currently-reading')
         logging.debug("Got %d readables from good reads" % len(readables))
         if user_changes:
             user_put.append(user)
     ndb.put_multi(user_put)
Exemple #3
0
 def get(self):
     from services import pocket, goodreads
     logging.debug("Running SyncReadables cron...")
     TS_KEY = 'pocket_last_timestamp'
     users = User.SyncActive(['pocket', 'goodreads'])
     user_put = []
     for user in users:
         # Pocket
         user_changes = False
         access_token = user.get_integration_prop('pocket_access_token')
         if access_token:
             success, readables, latest_timestamp = pocket.sync(
                 user, access_token)
             logging.debug("Got %d readables from pocket" % len(readables))
             user.set_integration_prop(TS_KEY, latest_timestamp)
             user_changes = True
         success, readables = goodreads.get_books_on_shelf(
             user, shelf='currently-reading')
         logging.debug("Got %d readables from good reads" % len(readables))
         if user_changes:
             user_put.append(user)
     ndb.put_multi(user_put)