I am trying to parse arguments in python code sent from slack... what does this mean is when someone types a command in slack I want to differentiate based on string and other args.
for eg in slack if I use !command inc-number some string and then sometimes !command inc-number word how could I differentiate both
===============================================================================
def update(self,*args):
inc = args[0]
id = self.getincsysid(inc) # this func gets the sysid of inc to be update in servicenow.
request = 'api/now/table/incident/'
service_now_url = service now url
url = service_now_url + request + id
headers = {"Accept": "application/json"}
# I am stuck here how to differentiate if args1 is a string.
if args[1] == 'string': #do below
requests.put(url, auth=(user, pwd), headers=headers, json=
{'comments': args})
return 'inc updated'
elif args[1]=='word':
impact = 'imapct1'
criticality= 'urgency1'
requests.put(url, auth=(user, pwd), headers=headers, json={'impact':
impact, 'criticality': urgency})
else:
return 'none matched'