Reputation: 59
I am trying to connect python to my league of legends chat (brazilian server) interface to try to run some automatic responses to pings and etc. But I'm not finding success. This is the code I'm running in python Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32. I'm using my username and password in my code.
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()
And these are the errors I'm getting
> 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
I'm fairly new to python and I'm wondering if there is an easier way to do this, maybe trying to connect directly through the client? I'm more familiar with R, is there an easir way to do it in it?
Upvotes: 3
Views: 513