-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Description
Hello,
I'm trying to run an example code from the repository and it returns:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in client
File "/usr/local/lib/python2.7/dist-packages/gql/client.py", line 23, in __init__
introspection = transport.execute(parse(introspection_query)).data
File "/usr/local/lib/python2.7/dist-packages/gql/transport/requests.py", line 38, in execute
request.raise_for_status()
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 862, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://swapi.graphene-python.org/graphql
After analysing the response, I saw that the error was due to a CSRF verification failure.
code:
from gql import Client, gql
from gql.transport.requests import RequestsHTTPTransport
query = gql('''
{
myFavoriteFilm: film(id:"RmlsbToz") {
id
title
episodeId
characters(first:5) {
edges {
node {
name
}
}
}
}
}
''')
client = Client(
transport=RequestsHTTPTransport(url='http://swapi.graphene-python.org/graphql')
)
client.execute(query)
Metadata
Metadata
Assignees
Labels
No labels