Closed
Description
I'm getting an error using the basic example syntax. You mention a warning below on the README and if this is it, I apologize, but I'm not familiar enough with AsyncIO to connect the dots.
My code:
class GraphQLClient:
transport = AIOHTTPTransport(url="https://fake.com/graphql")
client = Client(transport=transport, fetch_schema_from_transport=True)
def request(self, body):
return self.client.execute(body)
client = GraphQLClient()
r = client.request(
gql(
"""
query getUserID {
login( email_or_phone_or_username: "{username}" password:"{pw}") {
user_id
}
}
"""
)
)
The error:
File "/Users/michael/Documents/Projects/kpffl/sleeper.py", line 16, in request
return self.client.execute(body)
File "/Users/michael/Documents/Projects/kpffl/venv/lib/python3.8/site-packages/gql/client.py", line 113, in execute
loop = asyncio.get_event_loop()
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/events.py", line 639, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'Thread-8'.