api 相关问题

请勿使用:使用您所指的库,[api-design]或其他适当的标签进行标记。要求我们推荐或查找API的问题是偏离主题的。

我想使用 API 向我的 Facebook 页面添加评论

我想使用 API 添加评论到我的 FACEBOOK 和 INSTAGRAM 页面。 有人有更多这方面的信息吗? 我阅读了元 API 文档,但没有找到任何相关内容。 注意:我想整合...

回答 1 投票 0

从子屏向父屏传递数据时出现颤动错误(执行订单)

首先对英语的混乱感到抱歉,因为它不是我的母语。 所以我正在尝试构建一个汽车租赁应用程序,该应用程序在 flutter 中使用来自 google 的地图 api,我基本上有一个按钮可以获取

回答 1 投票 0

莱昂纳多人工智能Python

也许有人知道如何使用DramShaper V7在Python中的Leonardo AI中创建照片并返回图像链接'? 我只看到如何获取 id,我需要 URL,但我没有找到 dreamsha...

回答 1 投票 0

我正在尝试在 Laravel 中创建 API,但遇到问题

我正在尝试在Laravel中创建一个API,Laravel中的routes文件夹中有api.php文件吗?还是必须手动完成?因为当我创建它时该文件没有出现 我试过看...

回答 1 投票 0

我想在我的网站中包含来自weatherOpenMap的API以显示基于此的天气动态图标,但它没有显示

我将其包含在我的 html 标头中: 这是我的天气部分: <... I included this in my html header : <script src="main.js"></script> and this is in my weather section : <div class="weatherIcon"> <h2><span id="weather-icon">weather icon...</span></h2> </div> and this is in my javascript file (main.js) : const getWeather = async () => { try { const response = await fetch('https://api.openweathermap.org/data/2.5/weather?q=gothenburg,se&APPID=c95f90301395e8ce1cb18d910cd184cb'); const data = await response.json(); const weatherCondition = data.weather[0].id; const weatherIcon = getWeatherIcon(weatherCondition); document.getElementById('weather-icon').innerHTML = weatherIcon; } catch (error) { console.log('Error fetching weather data:',error); } }; // Function to get the appropriate weather icon based on the weather condition code const getWeatherIcon = (weatherCondition) => { if (weatherCondition >= 200 && weatherCondition < 300) { return '<i class="wi wi-thunderstorm weather-icon"></i>'; // Thunderstorm } else if (weatherCondition >= 300 && weatherCondition < 400) { return '<i class="wi wi-rain weather-icon"></i>'; // Drizzle } else if (weatherCondition >= 500 && weatherCondition < 600) { return '<i class="wi wi-day-rain weather-icon"></i>'; // Rain } else if (weatherCondition >= 600 && weatherCondition < 700) { return '<i class="wi wi-day-snow weather-icon"></i>'; // Snow } else if (weatherCondition >= 700 && weatherCondition < 800) { return '<i class="wi wi-fog weather-icon"></i>'; // Atmosphere } else if (weatherCondition === 800) { return '<i class="wi wi-day-sunny weather-icon"></i>'; // Clear } else if (weatherCondition > 800) { return '<i class="wi wi-day-cloudy weather-icon"></i>'; // Clouds } else { return ''; } }; // Call the getWeather function to fetch weather data and display the icon getWeather(); and this is in style.css : .weatherIcon { font-size: 2em; } 现在,当我在浏览器中打开我的index.html时,它会显示文本(天气图标...),所以我猜测文件已正确连接。当我在浏览器中搜索 API 时,它给了我一个数据,所以我不知道问题是什么,有人知道吗?预先感谢 我认为您的 HTML 中缺少 weather-icon 样式。 所有其他代码都可以。 index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Weather Icon Display</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.12/css/weather-icons.min.css"> <style> .weatherIcon { font-size: 2em; text-align: center; margin-top: 20px; color: #0056b3; } .weatherIcon i { color: #00468b; text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); } </style> </head> <body> <div class="weatherIcon"> <h2><span id="weather-icon">weather icon...</span></h2> </div> <script src="main.js"></script> </body> </html> main.js const getWeather = async () => { try { const response = await fetch('https://api.openweathermap.org/data/2.5/weather?q=gothenburg,se&APPID=c95f90301395e8ce1cb18d910cd184cb'); const data = await response.json(); const weatherCondition = data.weather[0].id; const weatherIcon = getWeatherIcon(weatherCondition); document.getElementById('weather-icon').innerHTML = weatherIcon; } catch (error) { console.log('Error fetching weather data:',error); document.getElementById('weather-icon').innerHTML = '<i class="wi wi-na"></i>'; // Default icon on error } }; // Function to get the appropriate weather icon based on the weather condition code const getWeatherIcon = (weatherCondition) => { if (weatherCondition >= 200 && weatherCondition < 300) { return '<i class="wi wi-thunderstorm weather-icon"></i>'; // Thunderstorm } else if (weatherCondition >= 300 && weatherCondition < 400) { return '<i class="wi wi-rain weather-icon"></i>'; // Drizzle } else if (weatherCondition >= 500 && weatherCondition < 600) { return '<i class="wi wi-day-rain weather-icon"></i>'; // Rain } else if (weatherCondition >= 600 && weatherCondition < 700) { return '<i class="wi wi-day-snow weather-icon"></i>'; // Snow } else if (weatherCondition >= 700 && weatherCondition < 800) { return '<i class="wi wi-fog weather-icon"></i>'; // Atmosphere } else if (weatherCondition === 800) { return '<i class="wi wi-day-sunny weather-icon"></i>'; // Clear } else if (weatherCondition > 800) { return '<i class="wi wi-day-cloudy weather-icon"></i>'; // Clouds } else { return ''; } }; // Call the getWeather function to fetch weather data and display the icon getWeather(); 结果

回答 1 投票 0

当用户在 Angular 11+ 中单击“重试”时如何调用相同的 API?

当 api 需要超过 30 秒才能给出响应时,我想停止加载程序并简单地在页面上显示“重试”按钮。 当用户单击该按钮时,我想调用相同的 API。 这整个专业...

回答 1 投票 0

处理 Scopus400pybliometrics 错误:超出最大查询限制

我正在使用 pybliometrics 库,使用复杂的查询在 Scopus 数据库中搜索一系列出版年份。但是,当我运行脚本时,我遇到了 Scopus400Error s...

回答 1 投票 0

从 Visual Basic 调用 REST API

我不断收到 404 错误。 如果我从 SoapUI 调用 REST API,效果很好。 我使用的是 Visual Basic VS2015。 我有一个示例函数,我从一个简单的表单项目中调用它。这只是为了...

回答 1 投票 0

Django:IntegrityError null 值违反了非空约束

在我的 django 应用程序中,发生了一些奇怪的事情,我不明白。 我有两个不同的表(employeeProfile 和 buyrShippingDetail),每个表都有一个与相关的字段...

回答 2 投票 0

如何将灯丝集成到现有的API应用程序

我有一个使用 Laravel 11 的生产就绪 API,我想集成灯丝以获得一些漂亮的视图,但我想将灯丝(创建、更新、列表)与我现有的 API 集成,而不是默认

回答 1 投票 0

Python、Websockets、Api、Unity、游戏开发 [已关闭]

`我们正在尝试开发一款游戏。此时我们想要实现的就是获取抖音直播信息。评论活动,点赞活动或者礼物活动等等这样的

回答 1 投票 0

Laravel 验证请求和 API 路由 POST 参数

我在表单请求验证以及如何使用一个 API 路由处理它方面遇到了一个小问题。 我需要创建的资源依赖于其他资源。 (这里 EmailSettings 属于

回答 3 投票 0

Java Script 在容器中显示 API 获取的数据

嗨,我是一名学生,正在尝试使用 JavaScript 创建一个使用 SpaceX API 的网页。初始获取请求会创建一张带有任务名称的卡片,当单击该卡片时,它会显示附加...

回答 1 投票 0

当调用某个API时如何路由到Next.js中的特定页面?

导出默认函数处理程序(req, res) { console.log("收到手势"); } 这是我在 page pi 文件夹中的代码。当调用 api 时,它会在控制台中打印:“已接收

回答 1 投票 0

如何为我的 Flask 后端创建 oauth2 APi

我是 Flask 的初学者,我想创建一个 oauth2 API 来将我的后端与外部应用程序一起使用,例如,当另一个应用程序使用我自己的应用程序时,oauth2 将介入该过程。(启用其他应用程序...

回答 1 投票 0

如何从API获取数据并在网页无响应的情况下显示?

我正在构建一个用 React 和“artsy.api”构建的猜谜游戏。单击按钮即可通过我的索引页访问猜谜游戏。 ...

回答 1 投票 0

Node.js 服务器中 Stripe API 的身份验证错误:缺少 API 密钥

我正在开发一个订阅服务,在客户端使用 React,在服务器端使用 Node.js。但是,我在尝试与 Stripe AP 交互时遇到身份验证错误...

回答 1 投票 0

如何创建通用模型来反序列化来自外部API的响应

我正在创建一个端点来从加密市场获取特定加密货币的价格。 我正在使用 Kucoin 和 Binance 的 API。当我收到回复时,两个回复中都有出价和询问字段....

回答 1 投票 0

React 应用中通过 Axios 向后端发送数据时的 CORS 问题

从源“http://localhost:5173”访问“http://localhost:8080/api/submitForm”处的 XMLHttpRequest 已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查。 ..

回答 1 投票 0

为什么 ReqRes 对我的 POST 请求的响应没有返回我包含的值?

我正在学习 API 等,我试图向 ReqRes.in 发送一个简单的 POST 请求。虽然 POST 响应表明请求成功,但它不包含我正在发送的数据,...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.