D
D
Dirollo2020-07-22 14:26:07
Python
Dirollo, 2020-07-22 14:26:07

How to change language in Pyowm (doesn't work via config)?

Ku, here is the code:

config_dict = get_config_from('config.json')
owm = pyowm.OWM('ed3d1e950f0d1e73b26cfd7f55fbb4f9', config_dict)

mgr = owm.weather_manager()
observation = mgr.weather_at_place(city)
        w = observation.weather
        l = w.temperature('celsius')['temp']
        nt = w.temperature('celsius')['temp_min']
        xt = w.temperature('celsius')['temp_max']
        temp = str(l) + " °C"
        answer = w.status
        hum = w.humidity
        mmr = str(hum) + "%"
        self.ids.res.text = str(temp)
        self.ids.res1.text = str(t_min + "/" + t_max)
        self.ids.res2.text = str(mmr)
        self.ids.res3.text = str(answer)

Everything works, here is the config:
{
    "api_key": "ed3d1e950f0d1e73b26cfd7f55fbb4f9",
    "subscription_type": "free",
    "language": "ru",
    "connection": {
        "use_ssl": true,
        "use_proxy": false,
        "verify_ssl_certs": true,
        "timeout_secs": 1
    }
}

But, it gives out a status not like "Clear", for example, but "Clear"
Toist in English. What to do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
ScriptKiddo, 2020-07-22
@Dirollo

answer = w.status
Change to
answer = w.detailed_status

img
5f184260684c8852900277.png

D
Dimonchik, 2020-07-22
@dimonchik2013

owm = pyowm.OWM('ed3d1e950f0d1e73b26cfd7f55fbb4f9', language = "RU", config_dict)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question