Huynh
Huynh

Reputation: 392

ValueError: scheme https is invalid in websocket client to say hello

I get similar problem as this question websockets "scheme https is invalid", but i'm actually trying to use https The problem is that I received an instruction of connecting for getting data from a server and in that document, he gave me the list of servers to connect. Unfortunately, it is a list of https://theirserverurl.com instead of wss:// as usual. I tried to say hello to one of such servers by:

from websocket import create_connection
ws = create_connection("https://theirserverurl.com")
print ("Sending 'Hello, World'...")
ws.send("Hello, World")
print ("Sent")
print ("Reeiving...")
result =  ws.recv()
print ("Received '%s'" % result)
ws.close()

And I got the error that:

ValueError: scheme https is invalid

Is there any solution to overcome this stack on python. Pls, help me. Thanks!

Upvotes: 0

Views: 3414

Answers (1)

passerby25
passerby25

Reputation: 31

Your URL is incorrect. You should enter the WSS URL like this:

wss://live-ws-pg-group3.kuaishou.com/websocket

Upvotes: 3

Related Questions