Reputation: 1
I'm incredibly weak with Python, but I thought I could knock together a basic script to alert me when a new user adds a card, and compare their credentials against the account sign-up information (to check for spammers).
Here's what I have in Zapier:
if input_data['card_name'] == input_data['account_name'] and input_data['card_country'] == input_data['account_country'] and input_data['card_type'] != 'prepaid':
print "Low Risk (valid credentials)"
elif input_data['card_name'] == input_data['account_name'] and input_data['card_country'] == input_data['account_country'] and input_data['card_type'] == 'prepaid':
print "Medium Risk (prepaid card)"
elif input_data['card_name'] != input_data['account_name'] and input_data['card_country'] == input_data['account_country'] and input_data['card_type'] != 'prepaid':
print "Medium Risk (name mismatch)"
elif input_data['card_name'] == input_data['account_name'] and input_data['card_country'] != input_data['account_country'] and input_data['card_type'] != 'prepaid':
print "Medium Risk (country mismatch)"
elif input_data['card_name'] != input_data['account_name'] and input_data['card_country'] != input_data['account_country'] and input_data['card_type'] == 'prepaid':
print "High Risk (consider investigating)"
It's a bunch of if
/ elif
, but for some reason it's not printing the output. I had it working when it was only two conditions per argument, but with three it seems to not want to print the output.
I'm getting this error now:
output_missing: Please define output or return early.
Am I making any mistakes that's preventing this from printing properly?
Upvotes: 0
Views: 1539
Reputation: 5262
David here, from the Zapier Platform team.
You're seeing this error because you're returning anything from the function (and the default output
variable that's returned if nothing else is is None
).
There's documentation about this here. If you return {'a': 1}
at the end of your if statements you'll see the print output as a result of the zap. Or, instead of printing you could return {'message': 'Low Risk (valid credentials)'}
, which will also show up as a result.
Either works, just depends what you need to do with the results.
Let me know if you've got any other questions!
Upvotes: 1