Message decoding check required.
https://github.com/davebshow/gremlinclient/blob/445677732400eab0d1d8a1c6006981a26527b0e2/gremlinclient/connection.py#L319
If the underlying WebSocket response message is already decoded, this call breaks. Ideally, there should be a check to accommodate this. Maybe assume already decoded if this line throws?
This might do the trick:
try: message = json.loads(result.decode("utf-8")) except AttributeError as e: message = json.loads(result)
Hi @vivekr20. I'm curious about this issue. Does the Gremlin Server ever return a message that isn't bytes? Have you seen an error here? If so, could you post code to reproduce it?
Also, as a side note, this project is basically inactive. Instead, I would recommend that you use either aiogremlin, Goblin, or the official gremlinpython.
Hi David,
Thank you for your response. I think It really depends on how the server chooses to send data over WebSocket? I’ve been working on Cosmos DB’s Gremlin Server, and if I configure the server to send data as String over WebSocket, I get the below error:
“AttributeError("'str' object has no attribute'decode'”
Full Call Stack:
“
ERROR:tornado.application:Exception in callback functools.partial(<function wrap.
Thanks for the pointers to the other clients BTW. I’m trying to build better compatibility for Cosmos DB’s gremlin API with Python client drivers, so the pointers will help! ☺ To start with, I want to build a few “hello world” samples for connecting to cosmos DB’s gremlin API using the one’s mentioned below. Could I reach out to you later, if I have any issues with working these client drivers?
Thanks, Vivek
From: David Michael Brown [mailto:[email protected]] Sent: Wednesday, September 13, 2017 9:35 AM To: davebshow/gremlinclient [email protected] Cc: Vivek Ravindran (COSMOS DB) [email protected]; Mention [email protected] Subject: Re: [davebshow/gremlinclient] Message decoding check required. (#14)
Hi @vivekr20https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvivekr20&data=02%7C01%7Cvivekra%40microsoft.com%7C59adb60f362c435959e808d4fac56f0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636409173262964822&sdata=zoHbk%2F6ljMz3BmnzNTg0TLitWHVV1hFxRInN35iEK7M%3D&reserved=0. I'm curious about this issue. Does the Gremlin Server ever return a message that isn't bytes? Have you seen an error here? If so, could you post code to reproduce it?
Also, as a side note, this project is basically inactive. Instead, I would recommend that you use either aiogremlin, Goblin, or the official gremlinpython.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdavebshow%2Fgremlinclient%2Fissues%2F14%23issuecomment-329224844&data=02%7C01%7Cvivekra%40microsoft.com%7C59adb60f362c435959e808d4fac56f0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636409173262964822&sdata=ou%2FedY9vrCMg1wEbKfcIACKDv7NXnB14uzbeWpk9t%2BY%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKT6bxygmH8YXBoFhZETDl9qy0lTHCKSks5siARLgaJpZM4PTw1U&data=02%7C01%7Cvivekra%40microsoft.com%7C59adb60f362c435959e808d4fac56f0a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636409173262964822&sdata=bRUg3diQV2fen4v2InInVsLtekFkP99QooYDHEf%2Bvbo%3D&reserved=0.
I would be happy to help you with anything related to the Python TinkerPop libraries. I would also love to see examples with CosmosDB. Please ping me with a link if you get anything up.
That would be greatly appreciated :) Will do!