-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing the request_context to graphql #7
Comments
@valentinradu Are you talking about the django channels implementation? |
Sorry for the late response. No, I'm using it with aiohttp, but this should apply to any implementations. |
So guys, we have a good pull request. what does we wait? |
@Arfey If you need this now I would just refer that branch directly in your requirements file. |
In case anyone else comes by this and they don't feel like installing a commit and then falling off the upgrade path... here's a nicer crutch: class ContextualAiohttpSubscriptionServer(AiohttpSubscriptionServer):
def __init__(self, schema, keep_alive=True, loop=None):
super().__init__(schema, keep_alive, loop)
self._check_updated()
@staticmethod
def _check_updated():
import pkg_resources
import warnings
from distutils.version import StrictVersion
graphql_ws_dist = pkg_resources.get_distribution('graphql_ws')
# https://github.com/graphql-python/graphql-ws/issues/7
if StrictVersion(graphql_ws_dist.version) > '0.2.0':
warnings.warn('`graphql_ws` is upgraded, check for `execute` fix')
import sys; sys.exit() # optional, terminate immediately!
def execute(self, request_context, params):
# https://github.com/graphql-python/graphql-ws/issues/7
params['context_value'] = request_context
return super().execute(request_context, params) It'll yell at you when |
Done |
Not sure if this is intended or not but shouldn't the context be taken outside the message processing?
In base.py:
Should be:
Otherwise, how can you pass the
request_context
? Does it make sense to be per message? Or is it intended for another use?The text was updated successfully, but these errors were encountered: