File tree 1 file changed +6
-6
lines changed
src/content/code/language-support/python/client 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ pip install qlient
15
15
16
16
Create a ` swapi_client_example.py ` file with this content:
17
17
18
- ``` python
19
- from qlient import Client , GraphQLResponse
18
+ ```` python
19
+ from qlient.http import HTTPClient , GraphQLResponse
20
20
21
- client = Client (" https://swapi-graphql.netlify.app/.netlify/functions/index" )
21
+ client = HTTPClient (" https://swapi-graphql.netlify.app/.netlify/functions/index" )
22
22
23
23
res: GraphQLResponse = client.query.film(
24
24
# swapi graphql input fields
@@ -28,10 +28,10 @@ res: GraphQLResponse = client.query.film(
28
28
_fields = [" id" , " title" , " episodeID" ]
29
29
)
30
30
31
- print (res.query) # query film($id: ID) { film(id: $id) { id title episodeID } }
32
- print (res.variables) # {'id': 'ZmlsbXM6MQ=='}
31
+ print (res.request. query) # query film($id: ID) { film(id: $id) { id title episodeID } }
32
+ print (res.request. variables) # {'id': 'ZmlsbXM6MQ=='}
33
33
print (res.data) # {'film': {'id': 'ZmlsbXM6MQ==', 'title': 'A New Hope', 'episodeID': 4}}
34
- ```
34
+ ````
35
35
36
36
Close the file and run it using python:
37
37
You can’t perform that action at this time.
0 commit comments