📅  最后修改于: 2023-12-03 15:17:45.075000             🧑  作者: Mango
Murree是巴基斯坦的一个小山镇,在此处获取当地的实时天气信息。
发送以下HTTP GET请求以获取天气数据:
https://api.openweathermap.org/data/2.5/weather?q=Murree,pk&units=metric&appid=API_KEY
请注意,这需要您将API_KEY
替换为您的OpenWeatherMap API密钥。
返回的JSON响应将包含有关天气的以下信息:
{
"coord": {
"lon": 73.38,
"lat": 33.91
},
"weather": [
{
"id": 802,
"main": "Clouds",
"description": "scattered clouds",
"icon": "03n"
}
],
"base": "stations",
"main": {
"temp": 14,
"pressure": 1012,
"humidity": 68,
"temp_min": 14,
"temp_max": 14
},
"visibility": 4000,
"wind": {
"speed": 1.5,
"deg": 140
},
"clouds": {
"all": 40
},
"dt": 1621972873,
"sys": {
"type": 1,
"id": 7579,
"country": "PK",
"sunrise": 1621928917,
"sunset": 1621978291
},
"timezone": 18000,
"id": 1160927,
"name": "Murree",
"cod": 200
}
在Markdown中,您可以使用以下代码段将天气数据嵌入到您的文件中:
Temperature: 14°C
Wind Speed: 1.5 m/s
Visibility: 4000 m
Humidity: 68%
Last updated: May 25, 2021 at 4:47 PM