如何使用 Twisted Words Python 库创建一个简单的 Google Talk 客户端?
我有兴趣使用 Python 制作 Google Talk 客户端,并希望使用 Twisted 库 Words 模块。 我已经查看了这些示例,但它们不适用于 Google Talk 的当前实现。
有人有这样的运气吗? 您介意记录一个简短的教程吗?
作为一项简单的任务,我想创建一个客户端/机器人来跟踪我的各个 Google Talk 帐户的在线时间,以便我可以获得总数。 我想我可以在每个帐户中与机器人加好友,然后使用 XMPP 存在信息来跟踪我可以聚合的时间。
谢谢。
I am interested in making a Google Talk client using Python and would like to use the Twisted libraries Words module. I have looked at the examples, but they don't work with the current implementation of Google Talk.
Has anybody had any luck with this? Would you mind documenting a brief tutorial?
As a simple task, I'd like to create a client/bot that tracks the Online time of my various Google Talk accounts so that I can get an aggregate number. I figure I could friend the bot in each account and then use the XMPP presence information to keep track of the times that I can then aggregate.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
wokkel 是扭曲词语的未来。 metajack 写了一个非常好的关于入门的博客文章。
如果您想要一个漂亮的、实用的示例项目开始,请查看我的 whatsup 机器人。
wokkel is the future of twisted words. metajack wrote a really nice blog post on getting started.
If you want a nice, functional sample project to start with, check out my whatsup bot.
我使用 xmpppy 库编写了一个简单的 Jabber 机器人(以及 Google Talk 机器人),效果很好。 xmpppy 上的示例应该可以帮助您入门(具体来说 xmpppy )。 net/examples/bot.py" rel="nofollow noreferrer">
bot.py
)至于在twisted.Words中实际实现的东西:
这里是一个关于创建机器人的简单教程,该机器人将收到的每条消息打印到本地终端(以及回复的版本)收到消息的尊敬)。 要跟踪各种帐户的在线时间,您可以添加“状态”回调(在 Jabber 术语中,在线/离线/离开等是“状态变化”)
对于更完整的系统,pownce-jabber-bot 使用twisted.words 和wokkel 用于 jabber 界面。
powncebot/__init__.py 文件似乎是一个很好的起点 - 它看起来非常简单。
I have written a simple Jabber bot (and thus Google talk bot) using the
xmpppy
library, which works well. The examples on xmpppy should get you started (specificallybot.py
)As for something actually implemented in twisted.Words:
Here is a simple tutorial on creating a bot that prints every received message to the local terminal (and a version that replies with the revere of the received message). To track the online time of various accounts, you would add a callback for "presences" (going online/offline/away etc are "presence changes", in Jabber terminology)
For a more complete system, pownce-jabber-bot uses twisted.words and wokkel for the jabber interface.
The powncebot/__init__.py file seems like a good place to start - it's seems pretty simple.
不久前我正在寻找用 python 构建 XMPP 客户端。 我还没有抽出时间去做我正在寻找的项目。 我没有看到任何使用扭曲的东西,但我找到了几个 XMPP 库。
我还发现了一个遵循 GPL 的 Python 程序,它使用 XMPP 来充当多点会议系统。
http://coders.meta.net.nz/~perry/jabber/ confbot.php
I was looking building an XMPP client in python a while ago. I haven't gotten around to working on the project I was looking at it for. I didn't see anything that used twisted but are a couple XMPP libraries I found.
I also found a python program, under the GPL, that acts multi-point conference system using XMPP.
http://coders.meta.net.nz/~perry/jabber/confbot.php
由于 Twisted 库似乎已经过时,您有两种选择:
实现您自己的 XMPP 处理程序或寻找另一个库。
我建议使用原始 XML; XMPP 并不复杂,您一定会学到一些东西。
As the Twisted libs seem to be out of date, you have two choices:
Implement your own XMPP-handler or look for another library.
I would suggest working with the raw XML; XMPP is not that complicated and you are bound to learn something.