Python gtalk 客户端代码不工作

标签 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)

最佳答案

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

关于Python gtalk 客户端代码不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13651865/

相关文章:

python - 如何在Python3中通过for循环时获得严格的单词匹配

php - 无法使用 XMPPHP 库在我的应用服务器和 GCM 的 CCS 之间建立 xmpp 连接

javascript - 在基于 Strophe.js 的聊天应用程序中处理状态

python - 如何在 Python 中以 Base64 编码长?

python - Cartopy:绘制删除国家边界的海岸线

Python:如何在给定索引列表的字符串中替换子字符串

linux - 在 Linux 中以编程方式创建的文件变为 NULL

linux - cronjob 未在 Docker 容器中运行抛出 Dockerfile

c - 在 1 行中将字符串发送到标准输出和套接字的方法

django - 使用 Socket IO(或 Strophe.js)、XMPP 和 Django 进行实时服务器推送