Yowsup身份验证不起作用

时间:2014-06-28 10:10:36

标签: python whatsapp yowsup

我试图用这个漂亮的库进行一些测试。

我已经使用yowsup-cli成功进行了测试,但现在我想创建一个小的python脚本来以智能方式管理事件(使用监听器/回调)。

我正在尝试这里解释的代码https://github.com/tgalal/yowsup/wiki/Yowsup-Library-Documentation

def onAuthSuccess(username):
print "Logged in with %s" % s
# make a call to method ready to be able to receive messages
methodsInterface.call("ready")


y = YowsupConnectionManager()
signalsInterface = y.getSignalsInterface()
methodsInterface = y.getMethodsInterface()
signalsInterface.registerListener("auth_success", onAuthSuccess)
methodsInterface.call("auth_login", ("username", "password"))

很明显,用户名应为nationNumber + phoneNumber,不带其他符号。但我不清楚应该在哪里找到密码。 使用cli,身份验证机制不同,需要注册。

你能帮帮我吗?感谢

2 个答案:

答案 0 :(得分:2)

只是因为你传递了正确的用户名和密码作为参数,但是有人遇到了同样的问题,即身份验证无法正常工作,你必须像在命令行客户端中那样对64位密码进行编码。

您必须通过手机使用Yowsup或WART OR注册来获取密码(https://github.com/tgalal/yowsup/issues/234?)

 import base 64
 password= 'randomletters+somenumbers=' #Get this by registering
 password = base64.b64decode(bytes(rawPass.encode('utf-8'))) 

这并不明显,我经常忘记,可能会出现问题。

答案 1 :(得分:0)

你可能想写

import base64

然而,这对我来说仍然不起作用,尽管使用yowsup-cli发送消息的工作正常。

我认识的身份验证似乎仍有差异。