ecthiender / py-graphql-client

Dead-simple GraphQL client with subscriptions over websockets
https://pypi.org/project/py-graphql-client/
Other
37 stars 11 forks source link

error subproto = headers.get("sec-websocket-protocol", None).lower() AttributeError: 'NoneType' object has no attribute 'lower' #31

Open jeremoquai opened 3 years ago

jeremoquai commented 3 years ago

Hi @ecthiender .

Trying to implement your solution to reach the WS : wss://ws.sorare.com/cable (correct URL given by the dev team)

Wrote a basic subscription that works on Playground.

But infortunately my script returns :

    subproto = headers.get("sec-websocket-protocol", None).lower()
AttributeError: 'NoneType' object has no attribute 'lower'

Any idea ?

Thanks !

rbdm-qnt commented 3 years ago

I get the same exact problem, were you ever able to solve this?

Nahid71 commented 2 years ago

I'm also getting the same issue

ecthiender commented 2 years ago

Hello all,

Thanks for reporting this. Let me look into it and get back

ecthiender commented 2 years ago

Hey folks, I'm not able to reproduce this error. Can you folks provide a minimal example to reproduce the error?

cc @Nahid71 @rbdm-qnt @jeremoquai

mbh86 commented 2 years ago

@ecthiender, here is an example :

from graphql_client import GraphQLClient

ws = GraphQLClient('wss://ws.sorare.com/cable')
def callback(_id, data):
  print("got new data..")
  print(f"msg id: {_id}. data: {data}")

query = """
  subscription {
    aCardWasUpdated {
      birthTxHash
    }
  }
"""
sub_id = ws.subscribe(query, callback=callback)

# later stop the subscription
ws.stop_subscribe(sub_id)
ws.close()

Thanks for your help :)