
    Vin                         d dl Z d dlmZmZ d dlmZ d dlmZ  eddg          Ze	                    d          defd	            Z
dS )
    N)	APIRouterHTTPException)openweathermap_api_key)WeatherRequest Weather)prefixtagsrequestc                 f  K   t           }	 t          j                    4 d {V }d}| j        | j        |ddd}|                    ||           d {V }|                                }|j        dk    rddd	cd d d           d {V  S |d
         d         d         }t          |d         d         d          }|d
         d         d         }	d|	 d}
| d| |
d	cd d d           d {V  S # 1 d {V swxY w Y   d S # t          $ r!}t          d|            ddd	cY d }~S d }~ww xY w)Nz/https://api.openweathermap.org/data/2.5/weathermetricja)latlonappidunitslang)params   zWeather Errorr   )weather_texticon_urlweatherr   descriptionmaintemp   iconz"https://openweathermap.org/img/wn/z@2x.pngu   ℃ zWeather API Error: )r   httpxAsyncClientr   r   getjsonstatus_coderound	Exceptionprint)r   API_KEYclienturlr   respdataweather_descr   	icon_coder   es               "/app/app/routers/weather_router.pyget_current_weatherr/      sX     $G4$&& 	 	 	 	 	 	 	&DC{{ ! F  C77777777D99;;D3&&(7RHH	 	 	 	 	 	 	 	 	 	 	 	 	 	   	?1-m<Lff-q11DY*62ININNNH $( ; ;\ ; ;$ -	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	6  4 4 4'A''((( "333333334sN   D AC29D AC2D 2
C<<D ?C< D 
D0D+%D0+D0)r   fastapir   r   app.core.configr   app.schemas.weather_schemasr   routerpostr/        r.   <module>r7      s     , , , , , , , , 2 2 2 2 2 2 6 6 6 6 6 6	

 
 

 R!4~ !4 !4 !4 !4 !4 !4r6   