englishtokorea/weather.py
2025-05-28 14:26:49 +09:00

23 lines
748 B
Python

import requests
import json
from forex_python.converter import CurrencyRates
c = CurrencyRates()
rate = c.get_rate('USD', 'KRW')
print("현재 원/달러 환율:", rate)
api = "https://api.openweathermap.org/data/2.5/weather?lat=35.8242238&lon=127.1479532&appid=00eb2155e51742aa2856a69da0f6dc61&lang=kr&units=metric"
result = requests.get(api)
result = json.loads(result.text)
weather = result['weather'][0]['description']
temperature = result['main']['temp'] #현제온도
feels_like = result['main']['feels_like'] #체감온도
humidity = result['main']['humidity'] #습도
weathertext = "전주지역 오늘날씨 : "+weather+", 현제온도:"+str(temperature)+"도, 체감온도:"+str(feels_like)+""
print(weathertext)