简体   繁体   English

通过Python中的代理连接到Jabber服务器(XMPPY)

[英]Connecting to Jabber Server Via Proxy in Python (XMPPY)

Trying to connect to jabber with proxy: 尝试使用代理连接到jabber:

 > JCON = xmpp.Client(server=SERVER, port=PORT, debug=[])
 > con=JCON.connect(server=(CONNECT_SERVER, PORT), proxy=(127.0.0.1, 80), secure=0,use_srv=True)

Without proxy it connects fine. 没有代理,它连接良好。 Is the proxy syntax right? 代理语法正确吗? Referring to 'Client.py' in XMPPY ( https://github.com/normanr/xmpppy/blob/master/xmpp/client.py ) might help to understand the syntax. 在XMPPY( https://github.com/normanr/xmpppy/blob/master/xmpp/client.py )中引用'Client.py'可能有助于理解语法。

Hoping for a response soon! 希望能尽快得到答复!

From the code you linked: 从您链接的代码:

'proxy' argument is a dictionary with mandatory keys 'host' and 'port' (proxy address) “ proxy”参数是带有强制键“ host”和“ port”(代理地址)的字典

You need to change it into a dictionary, like this. 您需要像这样将其更改为字典。

   con=JCON.connect(server=(CONNECT_SERVER, PORT), proxy={'host':'127.0.0.1', 'port':'80'}, secure=0,use_srv=True)

If you need authentication, you add 'user':'me','password':'secret' to the dictionary, like this 如果需要身份验证,可以在字典中添加'user':'me','password':'secret',例如

   con=JCON.connect(server=(CONNECT_SERVER, PORT), proxy={'host':'127.0.0.1', 'port':'80','user':'me','password':'secret'}, secure=0,use_srv=True)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM