Skip to content

Commit

Permalink
Update ariadne client code example.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdev-wb committed Apr 10, 2023
1 parent c26b51c commit 80ca5d9
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,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())
```

0 comments on commit 80ca5d9

Please sign in to comment.