Typo: Duplicate header name in authentication error message
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从 src/openai/_client.py 中同步客户端约第 664 行和异步客户端约第 1428 行的位置开始,然后比较身份验证错误消息。按描述修正重复的 header 名称并移除不必要的嵌入引号,然后重现凭据缺失的情况,以确认最终消息。
由索引模型根据 Issue 内容生成。
描述
name: Typo bug report
about: Typo in authentication error message (duplicate "Authorization")
title: 'Typo: Duplicate header name in authentication error message'
labels: bug, documentation
assignees: ''
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
There is a copy-paste typo in the _validate_headers error message in both the sync and async clients. The message says:
"
AuthorizationorAuthorizationheaders to be explicitly omitted"
But it should mention both supported auth headers: Authorization (Bearer tokens) and api-key (API key auth).
Looking at the X.509 auth code in src/openai/auth/_x509.py:66, the SDK actually checks for api-key, x-api-key, and proxy-authorization headers as well.
Locations
File: src/openai/_client.py
- Sync client, line 664:
raise TypeError(
'"Could not resolve authentication method. Expected either api_key or admin_api_key to be set. Or for one of the `Authorization` or `Authorization` headers to be explicitly omitted"'
)
- Async client, line 1428:
raise TypeError(
'"Could not resolve authentication method. Expected either api_key or admin_api_key to be set. Or for one of the `Authorization` or `Authorization` headers to be explicitly omitted"'
)
Proposed fix
Change the error message to correctly list the auth headers:
raise TypeError(
"Could not resolve authentication method. Expected either api_key or admin_api_key to be set. Or for one of the `Authorization` or `api-key` headers to be explicitly omitted"
)
(Also note the original message has extra leading/trailing double quotes inside the string which is also unnecessary.)
To Reproduce
Call any API method without setting credentials and without explicitly omitting auth headers.
Library version
v2.x latest (main branch)
- 主要语言
- Python
- 星标
- 31.7k
- 派生
- 5.8k
- 平均合并
- 2 天 10 小时
- 30 天内合并 PR
- 98
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
openai/openai-python 的其他 Issue
-
sdk-breaking-change v4
难度 2/5 1-3 小时 新手友好度 86/100
openai/openai-python#3837 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
openai/openai-python#3556 · 3 条评论 ·
维护者通常 1 天内回复
-
upstream
难度 2/5 1-3 小时 新手友好度 76/100
openai/openai-python#3294 · 3 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
openai/openai-python#2927 · 7 条评论 ·
维护者通常 1 天内回复
-
bug openapi
难度 2/5 1-3 小时 新手友好度 78/100
openai/openai-python#2502 · 7 条评论 ·
维护者通常 1 天内回复
查看 openai/openai-python 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
PedestrianDynamics/pyFDS-Evac#199 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
521xueweihan/HelloGitHub#3790 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
sandialabs/atlas-ui-3#978 ·
维护者通常 1 天内回复
-
area: tests perceived difficulty: 2
难度 2/5 1-3 小时 新手友好度 72/100
Nitjsefnie-Harness-Commons/daedalus#1255 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
EleutherAI/lm-evaluation-harness#4256 ·
维护者通常 1 天内回复