Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 849 Bytes

asynchronous.rst

File metadata and controls

28 lines (23 loc) · 849 Bytes

Asynchronous client

You also can use an AsyncClient <deezer.contrib.tornado.AsyncClient> with tornado, which requires an optional dependency. You should install with pip install deezer-python[tornado].

Then, making a request would look like this:

>>> from tornado.gen import coroutine
>>> from tornado.ioloop import IOLoop
>>> from deezer.contrib.tornado import AsyncClient
>>>
>>>
>>> @coroutine
... def main():
...     client = AsyncClient()
...     album = yield client.get_album(12)
...     print(album.title)
...
>>> IOLoop.instance().run_sync(main)
Monkey Business

The AsyncClient <deezer.contrib.tornado.AsyncClient> implements the same methods as the main Client <deezer.client.Client> class and would return the same resources.