Skip to main content

IPython Async_magic

Async at the top level repl !

In [1]: import aiohttp

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


In [3]: %load_ext async_magic

In [4]: res = %await aiohttp.get('https://api.github.com')

In [5]: await res.json()
Out[5]:
{'authorizations_url': 'https://api.github.com/authorizations',
 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}',
 'commit_search_url': 'https://api.github.com/search/commits?q={query}{&page,per_page,sort,order}',
 'current_user_authorizations_html_url': 'https://github.com/settings/connections/applications{/client_id}',
 'current_user_repositories_url': 'https://api.github.com/user/repos{?type,page,per_page,sort}',
 'current_user_url': 'https://api.github.com/user',
 'emails_url': 'https://api.github.com/user/emails',
 'emojis_url': 'https://api.github.com/emojis',
 ...
}

Note the % on assignments in res = %await aiohttp.get('https://api.github.com')

Change loop:

Use %loop <loop>

Release files for async_magic 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for async_magic 0.0.1
File Interpreter ABI Platform
async_magic-0.0.1-py3-none-any.whl Python 3 none any Details

Release files / async_magic-0.0.1-py3-none-any.whl

Download URL async_magic-0.0.1-py3-none-any.whl
Size 31.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b06816f8acbb6fed85436ae15853bb076cf48efa8a61db28bcdeb4a95dbf2915
BLAKE2b-256 checksum
How to use checksums
4a35a75af81d556c59e9dc66cd84062cb9c2b84712d67dfd277e7f8e2b992cd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page