I am new to making switch statements in python. I keep getting the error auth isn't identified in the following code. The argument of the switch statement should be the first element in msgparam which is a list of strings
class SendMessage :
def Auth_process(message):
val2 =0
for flag in message:
if(flag == '-raw'):
val1 |= 0x01
elif(flag == '-v'):
val1 |= 0x02
elif(flag == '-p'):
val1 |= 0x04
elif( flag == '-smple'):
val1 = 0x08
else:
val1 = val1
return Auth_process( val1, val2)
def command_process(arg, *args):
switcher ={
auth : Auth_process, ////error occurs here
rd : read,
}
func = switcher.get(arg)
return func(args)
def __init__(self, cmd):
status = False
value1= 0
value2= 0
result = '"This commandself is invalid please check arguments for appropriate size or invalid characters";'
msgparam = cmd.split(' ')
print(msgparam)
self.command_process(msgparam[0], msgparam)
if __name__ == '__main__':
data = SendMessage("auth -v -raw")