2014-12-23 4 views
2

whatsapp에 대한 API에서 작업 중이며 Yowsup을 사용 중입니다. 내가 Yowsup Cli 클라이언트를 사용할 때 whatsapp 계정에 로그인하여 메시지를주고받습니다. 다음 스크립트를 사용하려고하면 "Auth Failed!"가 반환됩니다.Yowsup auth fail whatsapp

import sys 
import os 
import logging 
import time 
import shutil 
import Queue 
from collections import defaultdict 

from Yowsup.Common.debugger import Debugger 
from Yowsup.connectionmanager import YowsupConnectionManager 

from py_utils import logutils 
from py_utils import executable_utils 
from py_utils import exception_utils 

from py_utils.cli_utils import actions_handler 


COUNTRY_CODE = "COUNTRY_NUM" 
PHONE_NUMBER = "MYNUMBER" 
# IDENTITY = "" 
PASSWORD = 'MY_PASS_WORD' 
LOGIN = COUNTRY_CODE + PHONE_NUMBER 

import argparse, sys, os, csv 
from Yowsup.Common.utilities import Utilities 
from Yowsup.Common.debugger import Debugger 
from Yowsup.Common.constants import Constants 
from Yowsup.Contacts.contacts import WAContactsSyncRequest 
from Yowsup.connectionmanager import YowsupConnectionManager 

import threading,time, base64 

########## DO NOT COMMIT THIS FILE WITH YOUR CREDENTIALS ########### 
#.....................WhatsApp Account Config....................... 

nickname = "lamaaaaaaa" 
username = LOGIN 
password = PASSWORD 

id = "" # Not required 

#.................................................................... 

# Degug is False by default if you add -d you will set it to True 
Debugger.enabled = True if '-d' in sys.argv else False 
password = base64.b64decode(bytes(password.encode('utf-8'))) 

def login(username, password): 
    print "[] Logging in as %s (%s)\n" % (nickname, username) 
    methodsInterface.call("auth_login", (username, password)) 

def onAuthSuccess(username): 
    print("Authed!!\n\n") 
    methodsInterface.call("ready") 
    methodsInterface.call("presence_sendAvailableForChat", (nickname,)) 

def onAuthFailed(username, err): 
    print("Auth Failed!") 

########################### BIND EVENTS ############################# 
connectionManager = YowsupConnectionManager() 
signalsInterface = connectionManager.getSignalsInterface() 
methodsInterface = connectionManager.getMethodsInterface() 
connectionManager.setAutoPong(True) 

signalsInterface.registerListener("auth_success", onAuthSuccess) 
signalsInterface.registerListener("auth_fail", onAuthFailed) 
##################################################################### 

login(username, password)  
+0

를 사용해야합니다. Common.debugger 가져 오기 디버거 및 Yowsup.connectionmanager 가져 오기에서 YowsupConnectionManager가 실행 중 오류가 발생합니까? 어떤 도움? 나는 이것이 경로로 무언가를해야한다고 생각한다. ??? – ZdaR

답변

2

문제는 액세스 토큰을 업데이트해야한다는 것입니다. Yowsup 패키지 이 아래 comon \ constans.py 거기에 tokanData를 업데이트 할 필요 :

tokenData = { 
    "v": "2.12.53", 
    "r": "S40-2.12.53", 
    "u": "WhatsApp/2.12.53 S40Version/14.26 Device/Nokia302", 
    "t": "PdA2DJyKoUrwLw1Bg6EIhzh502dF9noR9uFCllGk1416435341393{phone}", 
    "d": "Nokia302" 

    # "v": "2.12.15", 
    # "r": "S40-2.12.15", 
    # "u": "WhatsApp/2.12.15 S40Version/14.26 Device/Nokia302", 
    # "t": "PdA2DJyKoUrwLw1Bg6EIhzh502dF9noR9uFCllGk1391039105258{phone}", 
    # "d": "Nokia302" 
} 

당신은 차이를 볼 수있는 내가했고, 내가 Yowsup에서

+0

이 오류가 발생합니다 : Yowsup.connectionmanager 가져 오기 YowsupConnectionManager – ZdaR

+0

몇 가지 정보로 질문을 게시하고 링크를 추가하면 도움을 얻을 수 있습니다. –