import requests
from pprint import pprint

API_KEY="5336e012d93815186093aba805b3b392"

def checkcordinate(city,API_KEY):
    response=requests.get(f'http://api.openweathermap.org/geo/1.0/direct?q={city}&appid={API_KEY}')
    lat=response.json()[0]("lat")
    lon=response.json()[0]("lon")
    city=response.json()[0]("name")
    country=response.json()[0]("country")
    return lat, lon, city, country

def get_weather_info(lat,lon):
    response=requests.get("https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API_KEY}&lang=PL&units=metric")
    weather=response.json()["weather"][0]["description"]
    temperature=response.json()["main"]["temp"]
    pressure=response.json()["main"][0]["pressure"]
    humidity=response.json()["main"][0]["humidity"]
    return weather, temperature, pressure, humidity

start_city=input("Podaj nazwę miasta z którego podrórujesz:  ")
finall_city=input("Podaj nazwę miasta do którego podrórujesz:  ")


start_lat, start_lot, start_city, start_country=checkcordinate(start_city,API_KEY)
finall_lat, finall_lot, finall_city, finall_country=checkcordinate(finall_city,API_KEY)


print(f'nazwa panstwa w ktorym lezy {start_city} to {start_country}')