gpt4 book ai didi

python - 带有 python : xmpp. 协议(protocol)的 xmpp.InvalidFrom : (u'invalid-from', '' )

转载 作者:太空宇宙 更新时间:2023-11-04 11:05:40 26 4
gpt4 key购买 nike

cl = xmpp.Client('myserver.com')
if not cl.connect(server=('mysefver.com',5223)):
raise IOError('cannot connect to server')
cl.RegisterHandler('message',messageHandler)
cl.auth('myemail@myserver.com', 'mypassword', 'statusbot')
cl.sendInitPresence()

msgtext = formatToDo(cal, 'text')
message = xmpp.Message('anotheremail@myserver.com', msgtext)
message.setAttr('type', 'chat')
cl.send(message)

当我尝试运行它时收到以下错误消息:

xmpp.protocol.InvalidFrom: (u'invalid-from', '')

为什么会这样:(

最佳答案

来自 XMPP 协议(protocol) specification :

If the value of the 'from' address does not match the hostname represented by the Receiving Server when opening the TCP connection (or any validated domain thereof, such as a validated subdomain of the Receiving Server's hostname or another validated domain hosted by the Receiving Server), then the Authoritative Server MUST generate an stream error condition and terminate both the XML stream and the underlying TCP connection.

这基本上意味着,如果 xmpp 服务器无法识别发件人,它会回复此消息。 XMPP 提供注册机制:xmpp.features.register

关于python - 带有 python : xmpp. 协议(protocol)的 xmpp.InvalidFrom : (u'invalid-from', '' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1265146/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com