0

Hello there im trying to send a message with yowsup but i have not been successful can you please help me im getting IndentationError: unexpected indent Thank you

from yowsup.layers.interface import YowInterfaceLayer, ProtocolEntityCallback from yowsup.layers.protocol_messages.protocolentities import TextMessageProtocolEntity from yowsup.common.tools import Jid

class EchoLayer(YowInterfaceLayer):

@ProtocolEntityCallback("message")
def onMessage(self, messageProtocolEntity):

    if messageProtocolEntity.getType() == 'text':
        self.onTextMessage(messageProtocolEntity)

     reply = 1
     messageEntity = TextMessageProtocolEntity(reply,to = messageProtocolEntity.getFrom())

self.toLower(messageEntity)

    self.toLower(messageProtocolEntity.forward(messageProtocolEntity.getFrom()))
    self.toLower(messageProtocolEntity.ack())
    self.toLower(messageProtocolEntity.ack(True))


@ProtocolEntityCallback("receipt")
def onReceipt(self, entity):
    self.toLower(entity.ack())

def onTextMessage(self,messageProtocolEntity):
    # just print info
    print("Echoing %s to %s" % (messageProtocolEntity.getBody(), messageProtocolEntity.getFrom(False)))
Saxtor
  • 449
  • 1
  • 4
  • 15

2 Answers2

0

IndentationError: unexpected indent

This is a common kind of problem every pythoner has hit with. your code has some extra space or any tab is used.so basically you have to check every line and manually remove the excess gaps(shortcuts) and replace them with spaces insted.

0

The Unexpected indent error message will always tell you what line the problem is detected on.

In your case, it's obviously due to the fact that the if and reply lines don't match up.

o11c
  • 15,265
  • 4
  • 50
  • 75