Learned that we cannot use teacher clone repo to hold the project.
Began transferring code to the new backend repo through Tarun’s computer.
Had only 1 commit for work check due to transfer. requesting points back
Stayed on local host for temporary ease.
Created a fail safe in case JSON data does not go through:
class UserAPI:
class _CRUD(Resource): # User API operation for Create, Read. THe Update, Delete methods need to be implemeented
def get(self, ingredients): # Create method
api_key = '84cfe45628de456c87a13a80b76f5bd8' # Replace with your Spoonacular API key
url = f"https://api.spoonacular.com/recipes/findByIngredients?apiKey={api_key}&ingredients=" + ingredients
response = requestsget(url)
if response.status_code == 200:
data = response.json()
return jsonify(data)
else:
#return jsonify({"error": "Failed to fetch recipes."}), response.status_code
return {'message': f'hello'}, 400