requiredjson = set(["instance_name", "image", "username", "storage", "memory", "vcpu", "access_key"])
setrequest = set(request.json)
if requiredjson.issubset(setrequest):
#code here
pass
alternatively use get() to ensure those fields always have a value
do not unpack the whole dict into its own variables - use the dict as a dict
unsure if there's a way to set mandatory body fields in flask, look into that as well if you'd like
https://github.com/Slyplayer8990/cloudy/blob/3289fbd1e618223e23011e3c78061933e2dafb5d/app.py#L22-L33 Suggestion
alternatively use
get()
to ensure those fields always have a value do not unpack the whole dict into its own variables - use the dict as a dict unsure if there's a way to set mandatory body fields in flask, look into that as well if you'd like