yowsup_gateway package¶
Submodules¶
yowsup_gateway.exceptions module¶
-
exception
yowsup_gateway.exceptions.AuthenticationError[source]¶ Bases:
yowsup_gateway.exceptions.YowsupGatewayErrorRaised when gateway cannot authenticate with the whatsapp. This means the password for number is incorrect. Check if registration was correct
-
exception
yowsup_gateway.exceptions.ConfigurationError[source]¶ Bases:
yowsup_gateway.exceptions.YowsupGatewayErrorRaised when gateway detects and error in configurations
-
exception
yowsup_gateway.exceptions.ConnectionError[source]¶ Bases:
yowsup_gateway.exceptions.YowsupGatewayErrorRaised when gateway tries to perform an action which requires to be connected to WhatsApp
-
exception
yowsup_gateway.exceptions.UnexpectedError[source]¶ Bases:
yowsup_gateway.exceptions.YowsupGatewayErrorRaised for unknown or unexpected errors.
yowsup_gateway.layer module¶
-
exception
yowsup_gateway.layer.ExitGateway[source]¶ Bases:
exceptions.ExceptionRaised by GatewayLayer to exit stack loop
-
class
yowsup_gateway.layer.GatewayLayer[source]¶ Bases:
yowsup.layers.interface.interface.YowInterfaceLayerLayer to be on the top of the Yowsup Stack. :ivar bool connected: connected or not connected to whatsapp :ivar list ack_pending: list with incoming ack messages to receive :ivar list inbox: list of received messages from whatsapp :ivar list outbox: list of sent messages to whatsapp
-
CALLBACK_EVENT= 'org.openwhatsapp.yowsup.prop.callback'¶
-
EVENT_SEND_MESSAGES= 'org.openwhatsapp.yowsup.prop.queue.sendmessage'¶
-
PROP_MESSAGES= 'org.openwhatsapp.yowsup.prop.sendclient.queue'¶
-
on_ack(*args, **kwargs)[source]¶ Callback function when receiving an ack for a sent message from whatsapp
-
yowsup_gateway.results module¶
-
class
yowsup_gateway.results.SuccessfulResult(inbox=None, outbox=None)[source]¶ Bases:
objectAn instance of this class is returned from most operations when the request is successful. Get messages exchanged:: if result.is_success:
print [in_message for in_message in result.inbox] print [out_message for out_message in result.outbox]Variables: - inbox (list) – received messages from whatsapp
- outbox (list) – sent message to whatsapp
-
is_success¶ Returns whether the result from the gateway is a successful response
yowsup_gateway.stack module¶
-
class
yowsup_gateway.stack.YowsupGateway(credentials, encryption=False, top_layers=None)[source]¶ Bases:
yowsup.stacks.yowstack.YowStackGateway for Yowsup in a client API way
Variables: - result (SuccessfulResult) – List of inbox and outbox messages
- detached_queue (Queue) – Queue with callbacks to execute after
disconnection
-
receive_messages()[source]¶ Returns messages received from Whatsapp
Returns: list of inbox and outbox messages Return type: SuccessfulResult It contains exchanged messages with whatsapp.:
received_messages = result.inbox sent_messages = result.outbox
-
send_messages(messages)[source]¶ Send text messages
Parameters: messages – list of (jid, message) tuples Returns: list of inbox and outbox messages Return type: SuccessfulResult