Skip to content

Commit

Permalink
Adjust tornado example
Browse files Browse the repository at this point in the history
  • Loading branch information
bcb committed Sep 18, 2016
1 parent 2d0c0d6 commit 7202570
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,11 @@ asynchronous request.

client = TornadoClient('http://localhost:5000/')

def done_callback(future):
print(future.result())

async def main():
future = client.request('ping')
future.add_done_callback(done_callback)
await future
result = await client.request('ping')
print(result)

io_loop = ioloop.IOLoop.current().run_sync(main)
ioloop.IOLoop.current().run_sync(main)

Note the ``async``/``await`` syntax requires Python 3.5+. Prior to that use
`@gen.coroutine and yield
Expand Down

0 comments on commit 7202570

Please sign in to comment.