tgalal / yowsup

The WhatsApp lib
GNU General Public License v3.0
7.08k stars 2.23k forks source link

sample application login credential setup #2683

Open shekar3110a opened 5 years ago

shekar3110a commented 5 years ago

i think there is a issue in the run.py with sample provided .. in terms of passing the credential as from the message i got while registering doesn't contain the password .. how do i pass the configuration file to the stack ..

Shekar

shekar3110a commented 5 years ago

sorry this is in Version 3.0 the sample file still contains the credential in the format of v2.0 and 3.0 may need a different mechanism

maxi7587 commented 5 years ago

You can register yor number using requestcode and register commands. Then, in CREDENTIALS, set your phone number and leave the password as None (it will be taken from the configuration file created by yowsup : ~/.config/yowsup/{your_phone_number}/config.json).

Guilimac commented 5 years ago

Same here, but pass None in password brings this error: AttributeError: 'NoneType' object has no attribute 'axolotl_manager' I'm trying to figure out how can i load the config.js file

Guilimac commented 5 years ago

this works here ` from yowsup.stacks import YowStackBuilder from layer import EchoLayer from yowsup.layers import YowLayerEvent from yowsup.layers.network import YowNetworkLayer from yowsup.layers.auth import YowAuthenticationProtocolLayer from yowsup.common import YowConstants from yowsup.profile.profile import YowProfile from yowsup.config.manager import ConfigManager from yowsup.config.v1.config import Config

if name== "main": stackBuilder = YowStackBuilder()

stack = stackBuilder\
        .pushDefaultLayers()\
        .push(EchoLayer)\
        .build()
config_manager = ConfigManager()
config = config_manager.load_path("/path/to/config")
config.login = "49XXXXXXX"
profile = YowProfile(config.login,config)
stack.setProfile(profile)

stack.username = config.login

stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT))   #sending the connect signal

stack.loop() #this is the program mainloop`
shekar3110a commented 5 years ago

Hi Guilimac

tried your method, but got stuck on the config path .. am keeping getting the error ..

load_path couldn't find the path: /home/autobot/

i tried /home/autobot/.config as well

please let me know what should be actually used for load_path ..

Shekar

shekar3110a commented 5 years ago

ok manage to pass through the load_path error by giving the complete configuration file with .json file

and now i don't see that error, however am getting the below error;

Traceback (most recent call last): File "run.py", line 24, in stack.setProfile(profile) AttributeError: 'YowStack' object has no attribute 'setProfile'

tgalal commented 5 years ago

this has obviously deviated from original topic. please open seperate issues relevant to the problem you have