frontend/database.py
def open_weather_map(city):
    """Function for obtaining temperature from Yandex.

        Accepts the name of the city (city)
        The temperature is extracted from the JSON file obtained with OpenWeatherMap API.

        Return a list with two values.
        In case of success - value of temperature and URL, otherwise - error and URL.

    """
    try:
        #connect to OpenWeatherMap
        url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid=c7365fbce4cdaa0eed49c8adb6828336'.format(city)
        req = requests.get(url)

        #convert to degrees celsius
        temperature = float(req.json()['main']['temp']) - 273.15
        return [round(temperature, 1), url]

    except Exception as connection_error:
        return [connection_error, url]
Function for obtaining temperature from Yandex.

        Accepts the name of the city (city)
        The temperature is extracted from the JSON file obtained with OpenWeatherMap API.

        Return a list with two values.
        In case of success - value of temperature and URL, otherwise - error and URL.

    
Function for obtaining temperature from Yandex.
Accepts the name of the city (city)
The temperature is extracted from the JSON file obtained with OpenWeatherMap API.

Return a list with two values.
In case of success - value of temperature and URL, otherwise - error and URL.
Function for obtaining temperature from Yandex . Accepts the name of the city ( city ) The temperature is extracted from the JSON file obtained with OpenWeatherMap API . Return a list with two values . In case of success - value of temperature and URL otherwise - error and URL .
def open_weather_map(city):
    try:
        url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid=c7365fbce4cdaa0eed49c8adb6828336'.format(city)
        req = requests.get(url)
        temperature = float(req.json()['main']['temp']) - 273.15
        return [round(temperature, 1), url]
    except Exception as connection_error:
        return [connection_error, url]
def open_weather_map ( city ) : try : url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid=c7365fbce4cdaa0eed49c8adb6828336' . format ( city ) req = requests . get ( url ) temperature = float ( req . json ( ) [ 'main' ] [ 'temp' ] ) - 273.15 return [ round ( temperature , 1 ) , url ] except Exception as connection_error : return [ connection_error , url ]
Function for obtaining temperature from Yandex.
Function for obtaining temperature from Yandex .
"""Function for obtaining temperature from Yandex.

        Accepts the name of the city (city)
        The temperature is extracted from the JSON file obtained with OpenWeatherMap API.

        Return a list with two values.
        In case of success - value of temperature and URL, otherwise - error and URL.

    """ #connect to OpenWeatherMap #convert to degrees celsius
city