Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/code/language-support/python/client/ariadne-codegen.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ $ ariadne-codegen
And use it in your Python projects:

```python
import asyncio
from graphql_client import Client

with Client("http://example.com/graphql/") as client:
result = client.create_token(username="Admin", password="Example123)

async def create_token_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
return result.token

asyncio.run(create_token_gql())
```