import requests
from pprint import pprint

API_KEY = "3a7d953a0cbec45607ea1bc1b65c23e2"

def check_coordinates(city, API_KEY):
    responce = requests.get(f"https://api.openweathermap.org/geo/1.0/direct?q={city}&appid={API_KEY}")
    print(responce.status_code)
    pprint(responce.json())
    lat =  responce.json()[0]["lat"]
    lon = responce.json()[0]["lon"]
    city = responce.json()[0]["name"]
    country = responce.json()[0]["country"]
    return lat, lon, city, country

check_coordinates("London", API_KEY)

print("fricking end yourself!!!")
origin_city = input("podaj masto i guess: ")
destination_city = input("podaj kolejne miasto ty ##### ######!!!!!: ")

origin_lat, origin_lon, origin_city, origin_country = check_coordinates(origin_city, API_KEY)
destination_lat, destination_lon, destination_city, destination_country = check_coordinates(destination_city, API_KEY)

print(f"masto kture uhhhhhhhhhhhhhhh zapomniałem: {origin_city}")
print(f"miasto 2:O: {destination_city}")
print(f"braciak chciał free robux💀💀💀💀💀💀💀:\n{destination_lat} y:\n{destination_lon} x💀💀💀💀💀")

def get_weatherInfo(lat, lon):
    responce=requests.get(f"https://api.openweathermap.org/dat/2.5/weather?lat={lat}&lon={lon}&limit=1&appid={API_KEY}&lang=PL&units=metric")
    print(responce.status_code)
    pprint(responce.json())

    get_weatherInfo(destination_lat, destination_lon)