#3232 requests.exceptions.HTTPError: 415 Client Error: Unsupported Media Type for url: http://127.0.0.1:1234/?sk=123

223.98* Posted at: 13 hours ago 👁10

415 Client Error: Unsupported Media Type for url: http://127.0.0.1:1234/?sk=123:
Traceback (most recent call last):
File "videotrans\recognition\_base.py", line 80, in run
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 421, in exc_check
tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\util\TestSTT.py", line 18, in run
File "videotrans\recognition\__init__.py", line 211, in run
File "videotrans\recognition\_base.py", line 88, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\recognition\_recognapi.py", line 81, in _exec
File "requests\models.py", line 1026, in raise_for_status
requests.exceptions.HTTPError: 415 Client Error: Unsupported Media Type for url: http://127.0.0.1:1234/?sk=123


=
system:Windows-10-10.0.22621-SP0
version:v3.92
frozen:True
language:zh
root_dir:E:/shipfanyi/win-pyvideotrans-v3.92

1 Replies

这是由于自定义语音识别API的接口格式不匹配导致的。错误码415表示服务器无法处理请求的媒体类型。

解决方案:

  1. 检查API服务:确保你部署在 http://127.0.0.1:1234 的自定义语音识别API服务正在运行,并且其接口格式与pyVideoTrans的要求兼容。
  2. 验证接口规范:pyVideoTrans向自定义API发送请求时,预期接收并返回特定格式的JSON数据。请参考官方文档,确保你的API端点能正确处理 POST 请求,并返回正确的 text 字段。
  3. 升级软件版本:你当前使用的是 v3.92。建议升级到最新版 v3.97,可能包含对API兼容性的改进或更明确的错误提示。
  4. 检查请求头与数据:错误 415 Unsupported Media Type 通常意味着请求的 Content-Type 头(如 application/json)或请求体数据格式不被服务器接受。请检查你的API服务期望的格式。

请查阅相关文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Related resource

Similar issues already exist