load_introspection_from_server does not use custom headers
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- graphql, python
- 领域
- api, authentication
调研方向
从 utils_schema.py 中的 load_introspection_from_server 开始,跟踪 schema 加载如何接收已配置的 custom_header 值。检查经过身份验证的 introspection 请求路径,以及任何相关测试或命令配置。当加载 schema 时使用了已配置的标头,并且已报告的 401 情况得到覆盖时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Hello I'm trying to test gql but running gql run returned
[...]
File "/home/rdebroiz/.virtualenvs/test_gql/lib/python3.7/site-packages/gql/utils_schema.py", line 22, in load_schema
introspection = load_introspection_from_file(uri) if os.path.isfile(uri) else load_introspection_from_server(uri)
File "/home/rdebroiz/.virtualenvs/test_gql/lib/python3.7/site-packages/gql/utils_schema.py", line 13, in load_introspection_from_server
raise Exception(f'Query failed to run by returning code of {request.status_code}. {query}')
Exception: Query failed to run by returning code of 401.
[...]
I suspect the cause is that the custom headers are not used to load the schema from the configured endpoint.
def load_introspection_from_server(url):
query = get_introspection_query()
request = requests.post(url, json={'query': query})
if request.status_code == 200:
return request.json()['data']
raise Exception(f'Query failed to run by returning code of {request.status_code}. {query}')
Here is what my .gql.json look likes:
{
"schema": "http://hasura:10004/v1alpha1/graphql",
"endpoint": "http://hasura:10004/v1alpha1/graphql",
"documents": "./**/*.graphql",
"custom_header": {
"x-hasura-admin-secret": "adminpw",
"x-hasura-access-key": "userpw"
}
}
- 主要语言
- Python
- 星标
- 78
- 派生
- 6
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
graphql-python/gql-next 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
graphql-python/gql-next#30 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
graphql-python/gql-next#29 ·
-
难度 3/5 1-2 天 新手友好度 38/100
graphql-python/gql-next#28 ·
-
难度 5/5 一周以上 新手友好度 25/100
graphql-python/gql-next#27 ·
-
难度 5/5 一周以上 新手友好度 20/100
graphql-python/gql-next#22 · 1 条评论 ·
查看 graphql-python/gql-next 的全部 Issue
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 88/100
openwisp/openwisp-utils#777 ·
-
难度 2/5 1-3 小时 新手友好度 63/100
google-research/weatherbenchX#310 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
huggingface/peft#3955 ·
维护者通常 1 天内回复
-
author-page correction
难度 2/5 1-3 小时 新手友好度 60/100
acl-org/acl-anthology#10313 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
AOSSIE-Org/Gitcord-GithubDiscordBot#147 · 1 条评论 ·
维护者通常 1 天内回复