Commit a5151972 authored by okhin's avatar okhin 🚴

Returning an object on POST even if it already exist

parent 34a91dba
Pipeline #77 passed with stage
in 3 seconds
......@@ -20,6 +20,12 @@ def ari_call(config, verbs, method, payload):
payload['api_key'] = config['key'] + ':' + config['password']
result = call(full_url, data=payload)
result.raise_for_status()
if method.lower() == 'post':
# We need to test if we have something in the object, to eventually return it
try:
return result.json()
except:
result = requests.get(full_url, data=payload)
return result.json()
except:
raise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment