How do I get the http-request-session object into a graphene schema?
I have stored som values in request session that I need access thru. A possible solution is to send the session-id to the frontend and then pass it into the post request, but that does not seem like a good solution.
Graphene hast a context_value but I don't understand how I works.
Into my Django-views I put this:
schema = graphene.Schema()
schema.execute('{ viewer }', context_value={'session': request.session})
In my graphene schema if I try to do like described in the tutorial(https://github.com/graphql-python/graphene/blob/master/docs/execution/execute.rst), it says
'WSGIRequest' object has no attribute 'get'
class Query(graphene.ObjectType):
viewer = graphene.Field(Viewer)
def resolve_viewer(self, info):
info.context.get('session')
print(info.context.session.keys()) #an empty array
return Viewer()