#python #r #xmpp #chat #xmpppy
#python #r #xmpp #Чат #xmpppy
Вопрос:
Я пытаюсь подключить python к интерфейсу моего чата league of legends (бразильский сервер), чтобы попытаться запустить некоторые автоматические ответы на запросы и т.д. Но я не нахожу успеха. Это код, который я запускаю на python Python 3.7.7 (теги/ v3.7.7: d7c567b08f, март 10 2020, 10:41:24) [ 64-разрядная версия MSC v.1900 (AMD64)] для win32. Я использую свое имя пользователя и пароль в своем коде.
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:UserscaiohPycharmProjectsProjectBadBotvenvlibsite-packagesxmpppy-0.6.1-py3.7.eggxmppclient.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:UserscaiohPycharmProjectsProjectBadBotvenvlibsite-packagesxmpppy-0.6.1-py3.7.eggxmppclient.py",
> line 203, in connect File
> "C:UserscaiohPycharmProjectsProjectBadBotvenvlibsite-packagesxmpppy-0.6.1-py3.7.eggxmppclient.py",
> line 187, in connect File
> "C:UserscaiohPycharmProjectsProjectBadBotvenvlibsite-packagesxmpppy-0.6.1-py3.7.eggxmppdispatcher.py",
> line 126, in Process File
> "C:UserscaiohPycharmProjectsProjectBadBotvenvlibsite-packagesxmpppy-0.6.1-py3.7.eggxmppdispatcher.py",
> line 304, in dispatch File
> "C:UserscaiohPycharmProjectsProjectBadBotvenvlibsite-packagesxmpppy-0.6.1-py3.7.eggxmppdispatcher.py",
> line 216, in streamErrorHandler xmpp.protocol.HostUnknown:
> ('host-unknown', '')
>
> Process finished with exit code 1
Я довольно новичок в python, и мне интересно, есть ли более простой способ сделать это, может быть, попытаться подключиться напрямую через клиент? Я больше знаком с R, есть ли простой способ сделать это в нем?