From a88b17d50ec2c63bcb64d87859ef17a122edbe44 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 20 Mar 2022 01:51:50 -0700 Subject: feat(examples): python --- examples/python/client.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/python/client.py (limited to 'examples/python/client.py') diff --git a/examples/python/client.py b/examples/python/client.py new file mode 100644 index 0000000..68891ab --- /dev/null +++ b/examples/python/client.py @@ -0,0 +1,23 @@ +import asyncio + +from gql import gql, Client +from gql.transport.aiohttp import AIOHTTPTransport + + +async def main() -> None: + transport: AIOHTTPTransport = AIOHTTPTransport(url="https://graphql.senpy.club") + + async with Client(transport=transport, fetch_schema_from_transport=True) as client: + query = gql( + """ + query { + random: random { + image + } + } + """ + ) + + print((await client.execute(query))["random"]["image"]) + +asyncio.run(main()) -- cgit v1.2.3