本文介绍了ValueError:scheme https 在 websocket 客户端中无效打招呼的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了与这个问题类似的问题 websockets方案 https 无效",但我实际上是在尝试使用 https问题是我收到了从服务器获取数据的连接指令,在该文档中,他给了我要连接的服务器列表.不幸的是,它是一个 https://theirserverurl.com 的列表,而不是像往常一样的 wss://.我试图通过以下方式向其中一台服务器问好:

I get similar problem as this question websockets "scheme https is invalid", but i'm actually trying to use httpsThe 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()

我得到的错误是:

ValueError: scheme https is invalid

是否有任何解决方案可以在 python 上克服这个堆栈.请帮助我.谢谢!

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

推荐答案

您的 URL 不正确.您应该像这样输入 WSS URL:

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

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

这篇关于ValueError:scheme https 在 websocket 客户端中无效打招呼的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:27
查看更多