You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用Streamlabs API发送测试警报遭遇405错误求助

解决Streamlabs API send_test_alert接口405错误的问题

Hey there! That HTTP 405 error you're seeing means the server doesn't allow the request method you're using—and that's exactly the issue here.

核心问题:请求方法不匹配

The send_test_alert endpoint from Streamlabs API requires a GET request, not POST. Both of your attempts use requests.post(), which is why the server rejects them with a 405 "Method Not Allowed" error.

修正后的代码示例

Switch to requests.get() and your request should work. Here are the corrected versions of your two approaches:

方法1:用params传递参数(更推荐,符合规范)

import requests

url = "https://streamlabs.com/api/alerts/send_test_alert"
params = {
    "access_token": "UserAccessTokenHere",
    "type": "donation"
}
response = requests.get(url=url, params=params)
print(response.text)

方法2:直接在URL中拼接参数

import requests

url = "https://streamlabs.com/api/alerts/send_test_alert?access_token=UserAccessTokenHere&type=donation"
response = requests.get(url=url)
print(response.text)

额外确认

You already have the correct alerts.write scope in your OAuth permissions, so that part is set up perfectly—no issues there. Just swapping the request method from POST to GET should get your test alert working as expected.

内容的提问来源于stack exchange,提问作者HelloThereToad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:40:12