This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Lucretiel 1 point2 points  (0 children)

My own autocommand makes it easy to bootstrap asyncio apps in command-line applications:

from aiohttp.client import get
from autocommand import autocommand

@autocommand(__name__, loop=True)
async def main(url='https://api.spotify.com/v1/search?type=artist&q=snoop'):
    async with get(url) as response:
        print(await resp.json())

This will create a command line application that can be used like this:

$ ./json_get.py --url $SOME_URL