graphql / graphql.github.io

GraphQL Documentation at graphql.org

Home Page:https://graphql.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code sample for ariadne-codegen is outdated.

alexdev-wb opened this issue · comments

Description

Code sample for ariadne-codegen is outdated.

Motivation

Relevant code sample for ariadne-codegen.

Collaboration

Replace the code with something like this:

import asyncio
from graphql_client import Client


async def fetch_gql():
    client = Client("http://example.com/graphql/")
    result = await client.create_token(username="Admin", password="Example123")

    if result.errors:
        error = result.errors[0]
        raise ValidationError({error.field: error.message})

    auth_token = result.token

asyncio.run(fetch_gql())

thanks! could you submit a PR with a fix?