How Do I Query a Server?

This tutorial will show you how to query a HTTP server.

1
2
3
4
5
6
7
8
import ays

@ays.param(str, "account_host")
@ays.returns("num_accounts")
async def main(session, account_host):
    async with session.http.get(account_host) as resp:
        data = await resp.json()
        return data["num_accounts"]