To improve the code quality, here are the changes I have made to
the flickr.py
1- Image_data(): is a function that returns data or no data if the connection is successful and different error msg for different response errors
2- Extract_img_url_params(): this function uses the image_data and extracts the params needs to get the drink image
3- Retrieve_image(): uses the params extracted and finds a drink image and returns the response
4- Create_img_file(): this creates a file for the image in the images folder. And returns the file name
I also exclude the image file from the git repo
Changes made to api_controller.py:
In order not to mess up with the work that has already been done. I created the following function.
1- Handle_flickr_api_response(): this function handles the API response which could be (data, no data, error response – either error in querying or connection error)
2- Then I replaced the getImage() in the get_food_info() with the function that handles the Flickr API.
finally, I created a test file for flicker, and so far I was only able to test only one scenario.
To improve the code quality, here are the changes I have made to the flickr.py 1- Image_data(): is a function that returns data or no data if the connection is successful and different error msg for different response errors 2- Extract_img_url_params(): this function uses the image_data and extracts the params needs to get the drink image 3- Retrieve_image(): uses the params extracted and finds a drink image and returns the response 4- Create_img_file(): this creates a file for the image in the images folder. And returns the file name I also exclude the image file from the git repo
Changes made to api_controller.py: In order not to mess up with the work that has already been done. I created the following function. 1- Handle_flickr_api_response(): this function handles the API response which could be (data, no data, error response – either error in querying or connection error) 2- Then I replaced the getImage() in the get_food_info() with the function that handles the Flickr API.
finally, I created a test file for flicker, and so far I was only able to test only one scenario.