使用xmpppy模块与Google Talk服务器通信
条评论1、给XMPPPY模块的client.py源码打补丁,去掉SASL验证。这个是XMPPPY的一个Bug:
def auth(self,name,password,resource=’’,sasl=1):
改成
def auth(self,name,password,resource=’’,sasl=0):
2、连接
import xmpp
c=xmpp.Client(‘gmail.com’,debug=[])
c.connect(server=(‘talk.google.com’,5223))
‘ssl’
c.auth(‘aaa’,’123456’,’xmpppy’)
‘old_auth’
c.sendInitPresence()
#向Google Talk服务器发出上线消息
c.send(xmpp.protocol.Message(‘xxx@gmail.com‘,’hi,this is a message for testing’))