def fetch(s, url, **kwargs): self.assertEqual(url, expected_url) fut = asyncio.Future() response = ObjectDict() response.code = 200 response.body = content fut.set_result(response) return fut
def _on_github_request(future, response): """ Parse the JSON from the API """ if response.error: print response.error future.set_exception( AuthError("Error response {0!s} fetching {1!s}".format(response.error, response.request.url))) return result = ObjectDict(code=response.code, headers=response.headers, body=None) try: result.body = json_decode(response.body) except Exception: gen_log.warning("Invalid JSON from Github: %r", response.body) future.set_result(result) return future.set_result(result)
def _on_github_request(future, response): """ Parse the JSON from the API """ if response.error: print response.error future.set_exception( AuthError("Error response %s fetching %s" % (response.error, response.request.url))) return result = ObjectDict(code=response.code, headers=response.headers, body=None) try: result.body = json_decode(response.body) except Exception: gen_log.warning("Invalid JSON from Github: %r", response.body) future.set_result(result) return future.set_result(result)