def get(self): """ Demonstrates synchronous use of the Parsely client library """ p = Parsely(API_KEY, secrets[API_KEY]) res = p.analytics(aspect="authors") self.write(res) self.finish()
def get(self): """ Demonstrates asynchronous use of the Parsely client via a callback function Caller must be wrapped in @tornado.web.asynchronous Call to client method must include the _callback kwarg """ def callback(result): self.write(result) self.finish() p = Parsely(API_KEY, secrets[API_KEY]) p.analytics(aspect="authors", _callback=callback)