This repo consists of the assignment which is a part of the interview process for the cloud software team
-
Goto the project forlder
-
to to dist
-
open the command line window
-
Run main.exe (windows: .\main.exe)
-
Once asked, provide the names of the available ingredients seperated by spaces.
-
The result will be displayed in the window
-
To build executable for mac/linux, go to the directory with the main.py script, open the cmd, type: chmod +x main.py
-
Now, on the cmd, run the script by typing ./main.py
- This class is responsible to make all API requests to the food2fork API.
- The instantiation of an object of APIrequests type automatically loads data from the specified json file in the keys directory.
- Once the file is loaded, it is available for all methods.
- Each method of this class is responsible to make a single API request.
- Currently it has 2 member functions; foodSearch and getRecipeDetails.
- example: foodSearch
session=APIrequests()
if session.checkConnectivity():
topRatedRecipeId=session.foodSearch('potato,cabbage,rice')
This will return the recipe ID for the top rated recipe with the given ingredients as input parameters 7. Example: getRecipeDetails
session=APIrequests()
if session.checkConnectivity():
recipeDetails=session.getRecipeDetails('xyZ123')
This will return the details for recipe with the given recipe ID
- This class is responsible to compare between user input and the suggested recipe.
- In it's current state, It supports a diff function which creates a diff of the required ingredients minus the available ingredients.
- Example:
toCompare=compareIngredients(availIngredients,recipeDetails)
missingIngredients=toCompare.diff()
- Main execution code responsible to take user input, make requests to the food2fork API and then generate the list of the missing recipes
- main.py imports APIrequests and compareIngredients
- This code is also responsible for providing the user with information in an organised and informative mannar.
- In an ideal case, the API key should not be added to the repository and should be set as an env variable/input by the user. However, for convenience of execution, the API keys have been added to the repo here.