#!/home/../env/bin/python

# en la primera linea apuntamos al python de nuestro virtual env
# donde estan todas nuestras dependencias del proyecto y el python
# que se encarga de ejecutar el proyecto

from yowsup.stacks import  YowStackBuilder
from layer import EchoLayer
from yowsup.layers.auth import AuthError
from yowsup.layers import YowLayerEvent
from yowsup.layers.network import YowNetworkLayer
from yowsup.env import YowsupEnv

credentials = ("numberPhone", "PasswordWhatsapp")

if __name__==  "__main__":
    stackBuilder = YowStackBuilder()

    stack = stackBuilder\
        .pushDefaultLayers(True)\
        .push(EchoLayer)\
        .build()

    stack.setCredentials(credentials)
    stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT))   #sending the connect signal
    try:
        stack.loop() #this is the program mainloop
    except Exception as e:
        pass
