Hi, can anyone give me some advice? As part of my learning I decided to create a simple application working with the openWeather API. But I ran into a problem regarding the request.
val url = "<https://api.openweathermap.org/data/2.5/forecast/daily?q=hamburg,de&appid=33aa634c216259f797f35e862f07****>"
val resultJson = URL(url).readText()
Log.d("Weather Report", resultJson)
val jsonObj = JSONObject(resultJson)
val main = jsonObj.getJSONObject("main")
Attempting to execute then brings up the following:
https://pastebin.com/84EDhwyU
The debug basically did not detect any faults.
Anyway, the bug refers this line:
val resultJson = URL(url).readText()
Edit:
I will add that when I played with it yesterday I somehow mysteriously managed to get the resulting JSON, but only once and without any code modification. It's as if each time the resulting JSON was loaded incorrectly