Skip to content

Commit 80ca5d9

Browse files
committed
Update ariadne client code example.
1 parent c26b51c commit 80ca5d9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/content/code/language-support/python/client/ariadne-codegen.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,19 @@ $ ariadne-codegen
4242
And use it in your Python projects:
4343

4444
```python
45+
import asyncio
4546
from graphql_client import Client
4647

47-
with Client("http://example.com/graphql/") as client:
48-
result = client.create_token(username="Admin", password="Example123)
48+
49+
async def create_token_gql():
50+
client = Client("http://example.com/graphql/")
51+
result = await client.create_token(username="Admin", password="Example123")
4952

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

54-
auth_token = result.token
55-
```
57+
return result.token
58+
59+
asyncio.run(create_token_gql())
60+
```

0 commit comments

Comments
 (0)