
    o>i                     N    d dl Z d dlmZmZmZ d dlmZ  G d d      Z e       Zy)    N)ListDictAny)ProfileSearchResultc                   ,    e Zd Zdeeef   dee   fdZy)ExternalProfilerServicecriteriareturnc           	      6  K   d}|j                         D ci c]  \  }}|	|| }}}t        j                         4 d {   }	 t        d| d|        |j	                  ||d       d {   }|j                          |j                         }|j                  dg       }	|	D 
cg c]  }
t        d
i |
 }}
|cd d d       d {    S c c}}w 7 7 ic c}
w 7 # t        j                  $ rW}t        d|j                  j                   d|j                  j                          g cY d }~cd d d       d {  7   S d }~wt        $ r,}t        d	|        g cY d }~cd d d       d {  7   S d }~ww xY w# 1 d {  7  sw Y   y xY ww)Nz:http://therecruiter.miabetepe.com:8000/api/search-profileszSending request to z with criteria: g      N@)jsontimeoutresultszExternal API HTTP Error: z - z%Error calling external profiler API:  )itemshttpxAsyncClientprintpostraise_for_statusr   getr   HTTPStatusErrorresponsestatus_codetext	Exception)selfr	   urlkvcleaned_criteriaclientr   dataresults_dataitemr   es                B/home/www/utuvibe.miabetepe.com/app/search/external_api_service.pysearch_profilesz'ExternalProfilerService.search_profiles   s    J .6^^-=OTQAqDOO$$& 	 	&+C50@AQ@RST!'S7GQU!VV))+}}#xx	26COP4.66PP	 	 	 P	 W Q	 (( 1!**2H2H1IQZZ__L]^_		 	 	  =aSAB	#	 	 		 	 	s   F
CCFCFF	(C$1C2:C$,C>C$FC"FC$C$"F$F7:E	1F2F6FEF	FE<$F%F)F5E86F<FFF
FFFN)	__name__
__module____qualname__r   strr   r   r   r'   r       r&   r   r      s#    d38n FYAZ r,   r   )	r   typingr   r   r   app.search.schemasr   r   external_profiler_servicer   r,   r&   <module>r0      s&     " " 2 > 45 r,   