Muhammad Nabeel
Upload 5 files
bd8472c verified
raw
history blame contribute delete
485 Bytes
import requests
# Function to fetch recipe based on the classified label
def fetch_recipe(query: str):
api_url = f'https://api.api-ninjas.com/v1/recipe?query={query}'
headers = {'X-Api-Key': 'Hu4DkNyaIFT+E/FfCPRaYw==EUSFTIrXpCdQXrjH'}
response = requests.get(api_url, headers=headers)
if response.status_code == requests.codes.ok:
recipes = response.json() # Convert the response to JSON
return recipes
else:
return None