You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi Guys, I am st2 newer,please help me
Local webhook trigger : curl -X POST --data '{"name":"icon", "age":18}'
Action yaml parameters : content string
Action py :
from st2common.runners.base_action import Action
class WebexTeamsChatAction(Action):
def run(self, content):
content = json.loads(content)
print(content["name"])
return content["age"]
Raise error : json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
id: 642fc3b0f7419d50a9507cf8
action.ref: default.bot-index
context.user: stanley
parameters:
content: '{' 'name' ': ' 'icon' ', ' 'age' ': '18 }'
status: failed (1s elapsed)
start_timestamp: Fri, 07 Apr 2023 07:18:08 UTC
end_timestamp: Fri, 07 Apr 2023 07:18:09 UTC
👎 '{"name":"icon", "age":18}' --------> '{' 'name' ': ' 'icon' ', ' 'age' ': '18 }'
how to handle this string: '{' 'name' ': ' 'icon' ', ' 'age' ': '18 }'
python do not surpport ' '
Beta Was this translation helpful? Give feedback.
All reactions