Python gtalk客户端代码无法正常工作

时间:2012-11-30 19:32:37

标签: python linux xmpp

我正在尝试运行此代码来创建一个gtalk客户端,但它没有运行。我是一个新手,我想我做了一些愚蠢的错误。请帮助我。还请告诉我如何删除这些警告

#!/usr/bin/env python 

import xmpp 
import hashlib

user="username@gmail.com"
password="password"
server="gmail.com"

jid = xmpp.JID(user) 
connection = xmpp.Client(server,debug=[]) 
connection.connect() 
result = connection.auth(jid.getNode(), password,"LFY-client") 

connection.sendInitPresence() 

while connection.Process(1): 
    pass


The code is giving following error :


/usr/lib/python2.6/dist-packages/xmpp/auth.py:24: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import sha,base64,random,dispatcher,re
/usr/lib/python2.6/dist-packages/xmpp/auth.py:26: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import md5
/usr/lib/python2.6/dist-packages/xmpp/transports.py:308: DeprecationWarning: socket.ssl() is deprecated.  Use ssl.wrap_socket() instead.
  tcpsock._sslObj    = socket.ssl(tcpsock._sock, None, None)

1 个答案:

答案 0 :(得分:1)

这些警告不是错误,并且它们不是由您的代码引起的,xmpp模块正在使用一些已弃用的模块,我建议您升级它。