通过xmpp将python连接到英雄联盟聊天

问题描述

我正在尝试将python连接到我的英雄联盟聊天(巴西服务器)界面,以尝试对ping等运行一些自动响应。但是我没有找到成功。这是我在win32上的python Python 3.7.7(tags / v3.7.7:d7c567b08f,2020年3月10日,10:41:24)中运行的代码[MSC v.1900 64 bit(AMD64)]。我在代码中使用了用户名和密码。

import xmpp

conn = xmpp.Client("pvp.net")
if not conn.connect(server=("br.chat.si.riotgames.com",5223)):
    print ("connect failed.")
    exit()

if not conn.auth("USER","AIR_" + "PASSWORD","xiff"):
    print ("auth failed.")
    exit()

这些是我得到的错误

>   Invalid debugflag given: always Invalid debugflag given: nodebuilder
> DEBUG:  DEBUG: Debug created for
> C:\Users\caioh\PycharmProjects\ProjectBadBot\venv\lib\site-packages\xmpppy-0.6.1-py3.7.egg\xmpp\client.py
> DEBUG:  flags defined: always,nodebuilder DEBUG: socket       start
> Plugging <xmpp.transports.TCPsocket object at 0x000002529F9F0DC8> into
> <xmpp.client.Client object at 0x000002529F8DD3C8> DEBUG: socket      
> warn  Could not load one of the supported DNS libraries (dnspython or
> pydns). SRV records will not be queried and you may need to set custom
> hostname/port for some servers to be accessible.\n DEBUG: socket      
> start Successfully connected to remote host
> ('br.chat.si.riotgames.com',5223) DEBUG: tls          start Plugging
> <xmpp.transports.TLS object at 0x000002529FDCB248> into
> <xmpp.client.Client object at 0x000002529F8DD3C8> DEBUG: dispatcher  
> start Plugging <xmpp.dispatcher.Dispatcher object at
> 0x000002529FDE1948> into <xmpp.client.Client object at
> 0x000002529F8DD3C8> DEBUG: dispatcher   info  Registering namespace
> "unknown" DEBUG: dispatcher   info  Registering protocol "unknown" as
> <class 'xmpp.protocol.Protocol'>(unknown) DEBUG: dispatcher   info 
> Registering protocol "default" as <class
> 'xmpp.protocol.Protocol'>(unknown) DEBUG: dispatcher   info 
> Registering namespace "http://etherx.jabber.org/streams" DEBUG:
> dispatcher   info  Registering protocol "unknown" as <class
> 'xmpp.protocol.Protocol'>(http://etherx.jabber.org/streams) DEBUG:
> dispatcher   info  Registering protocol "default" as <class
> 'xmpp.protocol.Protocol'>(http://etherx.jabber.org/streams) DEBUG:
> dispatcher   info  Registering namespace "jabber:client" DEBUG:
> dispatcher   info  Registering protocol "unknown" as <class
> 'xmpp.protocol.Protocol'>(jabber:client) DEBUG: dispatcher   info 
> Registering protocol "default" as <class
> 'xmpp.protocol.Protocol'>(jabber:client) DEBUG: dispatcher   info 
> Registering protocol "iq" as <class 'xmpp.protocol.Iq'>(jabber:client)
> DEBUG: dispatcher   info  Registering protocol "presence" as <class
> 'xmpp.protocol.Presence'>(jabber:client) DEBUG: dispatcher   info 
> Registering protocol "message" as <class
> 'xmpp.protocol.Message'>(jabber:client) DEBUG: dispatcher   info 
> Registering handler <bound method Dispatcher.streamErrorHandler of
> <xmpp.dispatcher.Dispatcher object at 0x000002529FDE1948>> for "error"
> type-> ns->(http://etherx.jabber.org/streams) DEBUG: dispatcher   warn
> Registering protocol "error" as <class
> 'xmpp.protocol.Protocol'>(http://etherx.jabber.org/streams) DEBUG:
> socket       sent  <?xml version='1.0'?>   <stream:stream
> xmlns="jabber:client" version="1.0"
> xmlns:stream="http://etherx.jabber.org/streams" to="pvp.net" > DEBUG:
> socket       warn  SSL_WANT_READ while receiving data,asking for a
> retry DEBUG: socket       got   <?xml version='1.0'?>   <stream:stream
> xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'
> id='1475788316' from='br1.pvp.net'>   <stream:error>   <host-unknown
> xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>   </stream:error>  
> </stream:stream> DEBUG: dispatcher   ok    Got
> http://etherx.jabber.org/streams/error stanza DEBUG: dispatcher   ok  
> Dispatching error stanza with type->
> props->['urn:ietf:params:xml:ns:xmpp-streams'] id->None Traceback
> (most recent call last):   File
> "C:/Users/caioh/PycharmProjects/ProjectBadBot/test,py",line 4,in
> <module>
>     if not conn.connect(server=("br.chat.si.riotgames.com",5223)):   File
> "C:\Users\caioh\PycharmProjects\ProjectBadBot\venv\lib\site-packages\xmpppy-0.6.1-py3.7.egg\xmpp\client.py",> line 203,in connect   File
> "C:\Users\caioh\PycharmProjects\ProjectBadBot\venv\lib\site-packages\xmpppy-0.6.1-py3.7.egg\xmpp\client.py",> line 187,in connect   File
> "C:\Users\caioh\PycharmProjects\ProjectBadBot\venv\lib\site-packages\xmpppy-0.6.1-py3.7.egg\xmpp\dispatcher.py",> line 126,in Process   File
> "C:\Users\caioh\PycharmProjects\ProjectBadBot\venv\lib\site-packages\xmpppy-0.6.1-py3.7.egg\xmpp\dispatcher.py",> line 304,in dispatch   File
> "C:\Users\caioh\PycharmProjects\ProjectBadBot\venv\lib\site-packages\xmpppy-0.6.1-py3.7.egg\xmpp\dispatcher.py",> line 216,in streamErrorHandler xmpp.protocol.HostUnknown:
> ('host-unknown','')
> 
> Process finished with exit code 1

我对python还是很陌生,我想知道是否有更简单的方法可以做到这一点,也许尝试直接通过客户端进行连接?我对R较为熟悉,在其中有简便的方法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...