py-graphql-client icon indicating copy to clipboard operation
py-graphql-client copied to clipboard

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

Open jeremoquai opened this issue 3 years ago • 5 comments

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 !

jeremoquai avatar Apr 14 '21 14:04 jeremoquai

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

rbdm-qnt avatar Nov 17 '21 00:11 rbdm-qnt

I'm also getting the same issue

Nahid71 avatar Nov 23 '21 10:11 Nahid71

Hello all,

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

ecthiender avatar Nov 28 '21 08:11 ecthiender

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

ecthiender avatar Dec 28 '21 07:12 ecthiender

@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 :)

mbh86 avatar Jan 03 '22 15:01 mbh86