我正在制作一个react应用程序,它向OpenWeather发送一个API调用,以获取城市的天气数据(由用户指定)。响应中获得的数据存储在一个名为weatherData的变量中。这样,我就可以随时调用该变量,下面是一个使用此变量的HTML代码示例: temperature is {weatherData.temp} C
因此,如上所述,我在从openweatherapi中抓取数据时遇到了一个问题。我用bs4做过一些抓取的练习,但是openweatherapi的格式是完全不同的。哈哈。url = "https://api.openweathermap.org/data/2.5/onecall?it were a json data type.
html