Skip to main content

Define an async_magic for IPython that fake the async keyword at top level

Project description

IPython Async_magic

Async at the top level repl !

In [1]: import aiohttp

In [2]: res = await aiohttp.get('')
  File "<ipython-input-2-52b78a6e45a0>", line 1
    res = await aiohttp.get('')
SyntaxError: invalid syntax

In [3]: %load_ext async_magic

In [4]: res = %await aiohttp.get('')

In [5]: await res.json()
{'authorizations_url': '',
 'code_search_url': '{query}{&page,per_page,sort,order}',
 'commit_search_url': '{query}{&page,per_page,sort,order}',
 'current_user_authorizations_html_url': '{/client_id}',
 'current_user_repositories_url': '{?type,page,per_page,sort}',
 'current_user_url': '',
 'emails_url': '',
 'emojis_url': '',

Note the % on assignments in res = %await aiohttp.get('')

Change loop:

Use %loop <loop>

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for async_magic, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size async_magic-0.0.1-py3-none-any.whl (31.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page