質問編集履歴

1

試したことにresponseの中身を追記しました.

2023/09/04 11:21

投稿

kokou
kokou

スコア1

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ### 前提
6
6
 
7
- 最近pythonを勉強し始めた人間です.
7
+ 最近プログラミング,pythonを勉強し始めた人間です.
8
8
  初めて質問させていただくため,情報不足など至らない点があるかもしれませんが,ご了承ください.
9
9
  基礎を勉強し,現在は最高気温や最低気温,降水確率を取得し,任意の時間にLINEに表示するbotを作成中です.
10
10
  apiから気象予報データを取得するコードがある程度書けたため,試しに東京の3時間後の予報の取得を試みました.
@@ -109,7 +109,10 @@
109
109
  Keyerror: 'main'
110
110
  と出てきます.
111
111
 
112
+ responseの中身は以下の通りでした.
113
+ {'cod': '200', 'message': 0, 'cnt': 1, 'list': [{'dt': 1693828800, 'main': {'temp': 28.34, 'feels_like': 34.25, 'temp_min': 27.81, 'temp_max': 28.34, 'pressure': 1010, 'sea_level': 1010, 'grnd_level': 1008, 'humidity': 87, 'temp_kf': 0.53}, 'weather': [{'id': 500, 'main': 'Rain', 'description': '小雨', 'icon': '10n'}], 'clouds': {'all': 75}, 'wind': {'speed': 2.86, 'deg': 182, 'gust': 3.93}, 'visibility': 10000, 'pop': 0.62, 'rain': {'3h': 1.24}, 'sys': {'pod': 'n'}, 'dt_txt': '2023-09-04 12:00:00'}], 'city': {'id': 1857654, 'name': '東京都千代田区丸の内', 'coord': {'lat': 35.6813, 'lon': 139.766}, 'country': 'JP', 'population': 0, 'timezone': 32400, 'sunrise': 1693772087, 'sunset': 1693818368}}
112
114
 
115
+ 見ていただいたら分かる通り,weatherは存在しています.
113
116
 
114
117
  ### 補足情報(FW/ツールのバージョンなど)
115
118