def save(self, recipe):
<EOL>if '<STR_LIT:id>' in recipe and recipe['<STR_LIT:id>'] is not None:<EOL><INDENT>self.logger.debug("<STR_LIT>" + json.dumps(recipe))<EOL>url = '<STR_LIT>' % {<EOL>'<STR_LIT>': self.base_url, '<STR_LIT>': recipe['<STR_LIT:id>']<EOL>}<EOL>r = self.gbdx_connection.put(url, json=recipe)<EOL>try:<EOL><INDENT>r.raise_for_status()<EOL><DEDENT>except:<EOL><INDENT>print(r.text)<EOL>raise<EOL><DEDENT>return recipe['<STR_LIT:id>']<EOL><DEDENT>else:<EOL><INDENT>self.logger.debug("<STR_LIT>" + json.dumps(recipe))<EOL>url = '<STR_LIT>' % {<EOL>'<STR_LIT>': self.base_url<EOL>}<EOL>r = self.gbdx_connection.post(url, json=recipe)<EOL>try:<EOL><INDENT>r.raise_for_status()<EOL><DEDENT>except:<EOL><INDENT>print(r.text)<EOL>raise<EOL><DEDENT>recipe_json = r.json()<EOL>return recipe_json['<STR_LIT:id>']<EOL><DEDENT>
Saves an AnswerFactory Recipe

Args:
    recipe (dict): Dictionary specifying a recipe

Returns:
    AnswerFactory Recipe id