I am currently writing a zapier "zap" that detects for a certain gitlab project when a pipeline status is changed it then sends a embed to discord depending on what status it is at this is all for my continous intergration error reporting, to do this I have used multiple webhooks, the first webhook detects when there is a pipeline change via gitlabs webhook system (this works fine), then another one which gets the recent tag so it can display what tag is being deployed (this also works fine), then a couple selection statements in the form of python code which determines what type of embed should be sent to discord (problem), and then finally a custom webhook request which sends the discord embed (also works fine).
The code which currently isn't working is in python:
if "name: unit_test" in input_data.get("Build") and "status: failed" in input_data.get("Build"):
output = [{'colour': 13832489, 'text': 'Unit test has Failed'}]
elif "name: unit_test" in input_data.get("Builds") and "status: passed" in input_data.get("Builds"):
output = [{'color': 7841089, 'text': 'Unit test has passed test'}]
elif "name: deploy_development" in input_data.get("Builds") and "status: pending" in input_data.get("Builds"):
output = [{'color': 6199517, 'text': 'Version' + input_data.get("version") + 'is being pushed to production...' }]
elif "name: deploy_development" in input_data.get("Builds") and "status: passed" in input_data.get("Builds"):
output = [{'color': 7841089, 'text': 'Deployed' + input_data.get("version") + 'to production!' }]
and the inputs are
(source: edbrook.site)
this are stored in a disctionary input_data per normal code with zapier.
The error I receive when I test only the python code module is this: TypeError: argument of type 'NoneType' is not iterable
, upon looking into this error, it happens when a function is returned without a value. I havnt used a function, so what function is being returned?
and input would be appreciated, Thanks.
I would guess that input_data.get("Build")
is returning None
. dict.get
returns None
if the key isn't in the dictionary, which would give that same TypeError
.