
    MgP                     h    S SK r S SKJrJr  S SKJr  S SKJr  \" SS9\" S5      S 5       5       rS	 rg)
    N)pluginrequire)Fore)BeautifulSoupT)networkzfood recipec                    U R                  S[        R                  5      n[        S5        [        S5        [        S5        [        S5        [        S5        [        S5        [        S5        0 S	S
_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS _S!S"_S#S$_S%S&_S'S(_S)S*_S+S,0EnU R                  S-[        R                  5      nXC;   a  X4   n[        S.U5        O[        S/5        [        UW5        g0)1z
function gets the choice of the type of cuisine the user wants.

user must get an api key from https://spoonacular.com/food-api/docs#Authentication
THIS WILL NOT WORK WITHOUT THE API KEY.

user has to input api key everytime they run the plugin
zuEnter spoonacular.com food-api API_KEY (visit https://spoonacular.com/food-api/docs#Authentication) for getting one: zC--------------------------ENTER CUISINE----------------------------z%1. Indian 		 7. European 		 13. Cajunz+2. Asian 		 8. German 		 14. Middle Easternz-3. British 		 9. Korean 		 15. Latin Americanz#4. Mexican 		 10. Irish 		 16. Thaiz,5. Italian 		 11. American 		 17. Vietnamesez,6. Chinese 		 12. Mediterranean 	 18. Jewish1Indian2Asian3British4Mexican5Italian6Chinese7European8German9Korean10Irish11American12Mediterranean13Cajun14zMiddle Eastern15zLatin American16Thai17
Vietnamese18Jewishz$Enter Cuisine (no. of the cuisine): zSelected cuisine:z+Invalid input. Please enter a valid choice.N)inputr   GREENprintREDgetAllRecipes)jarvissuser_api_keycuisine_dictcuisine_inputcuisines         A/Users/admin/workspace/ai/Jarvis/jarviscli/plugins/food_recipe.py
getChoicesr7      s    <<

L 

OP	
56	
;<	
=>	
34	
<=	
;<XW 	Y 	Y	
 	Y 	Y 	Z 	X 	X 	g 	j 	o 	g 	 	  	f!" 	l#$ 	h%L* LL!GRM $-!7+;<,(    c                    SU  SU S3n[         R                  " U5      nUR                  S:X  Ga  UR                  5       n/ nUS    H  nUR	                  US   5        M     [        S5        [        US5       H  u  px[        U S	U 35        M       [        [        S
5      5      n	[        5         SU	s=::  a  [        U5      ::  a  O  OO[        S[        R                  5         MV  XYS-
     n
US    H  nUS   U
:X  d  M  US   n  O   [        SU
 3[        R                  5        SW SU  S3n[         R                  " U5      nUR                  S:X  a  UR                  5       n US   n[        US5      nUR                  5       nUS   nUS   S   S   S   S   n[        S5        [        U5        [        S5        [        U5        [        S5        [        U5        US   n[        S5        U H.  nUS   nUS   n[        S U S!U S"3[        R                   5        M0     [        S#[        R"                  5        g [        S$5         g [        S$5        g ! [         a    [        S[        R                  5         GNf = f)%Nz9https://api.spoonacular.com/recipes/complexSearch?apiKey=z	&cuisine=z&includeNutrition=true.   resultstitlez?--------------------------FOOD ITEM----------------------------   z. z6Enter the number corresponding to the title you want: z/Invalid selection. Please enter a valid number.z%Invalid input. Please enter a number.idzSelected Title: z$https://api.spoonacular.com/recipes/z/information?apiKey=z&includeNutrition=falsesummaryzhtml.parser	sourceUrlanalyzedInstructionsr   stepsstepzSummary:z
Description:z
Source URL:extendedIngredientsz
Ingredients:originalaislez- z	 (Aisle: )z
Hope you enjoy your food!z%Network down. Please try again later.)requestsgetstatus_codejsonappendr-   	enumerateintr+   lenr   r.   
ValueErrorCYANr   get_textr,   BLUE)apiKeyr5   urlresponsecontenttitlesitemindexr<   selected_indexselectedTitle
selectedIdurl2responseRecipeInformationcontent2summary_htmlsoupsummary_text
source_urldescriptioningredients
ingredientoriginal_valuerF   s                           r6   r/   r/   @   s   EfXYW^V__v
wC||C H s"--/ I&DMM$w-( ' 	OP%fa0LEUG2eW%& 1 I!$U+c%f!g5#f+5KTXXV  12I&DG}-!$Z
 '
 	 0$))< 6j\AUV\U]]tu$,LL$6!$00C70557H $I.L !}=D==?L!+.J"#9:1=gFqIK *,"#+/"* ##89K"#)
!+J!7"7+>*)E7!<djjI *
 /;
  9:  	56
}  I=txxHIs   7I I $JJ)	rH   r   r   coloramar   bs4r   r7   r/    r8   r6   <module>rl      s>     "   	4)  4)n]r8   