Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Python script with "list.rain.3h" not working

Pythoneur Jun 08, 2019 01:30PM BST

Hi,

It works with all parameters but for rain.3h and snow.3h (for forecasting purposes) it does not work.

Example :

data = requests.post(api_call)
humidity = []
rain = []

data = data.json()

for lists in data['list']:
humidity.append(lists['main']['humidity'])
rain.append(lists['rain']['3h'])

I have the message: "KeyError rain"

I don't know why it doesn't work with "3h" because I follow what your documentation says : https://openweathermap.org/forecast5

list.rain
list.rain.3h Rain volume for last 3 hours, mm

Up 0 rated Down
Pavel Zuykov Jun 14, 2019 01:32PM BST OpenWeatherMap Agent

Hello,

Does this value present in the JSON outputs? It may be omitted from JSON, if main weather is not “Rain”

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)
9eda11838f597e7a95b6a1c991dcae0a@openweathermap.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete