Add .netrc support when using --auth-type bearer
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- authentication, cli
调研方向
首先跟踪 --auth-type bearer 如何处理凭据,以及现有的 basic 身份验证如何读取 .netrc。将请求的 machine/password 示例与链接的 xh 行为进行比较,然后验证 bearer 标头是在不硬编码令牌的情况下生成的,并在需要时记录所需的 .netrc 条目。
由索引模型根据 Issue 内容生成。
描述
Checklist
- I've searched for similar feature requests. The closest I found is where this was implemented in xh
Enhancement request
When using https, I don't want to have to hard-code my token in all scripts, rather I would like to have a central location where the token can be read from. This already works for the basic authentication type, but not, as far as I can tell, for the bearer auth type.
If this is implemented, then this enhancement request is to document it clearly, what needs to be in the file as https://httpie.io/docs/cli/netrc does not seem to cover it.
Problem it solves
I'm always frustrated when writing a script that I need to hard code the token in it, as it makes the script harder to share.
Additional information, screenshots, or code examples
This is implemented in xh and with the following in the .netrc:
machine host.local.lan password SecretToken
then
xh --json --auth-type bearer "https://host.local.lan/rest/api/latest/…"
Correctly sends the header:
Authorization: Bearer SecretToken
It would be great if httpie would support this same functionality.
- 主要语言
- Python
- 星标
- 38.7k
- 派生
- 4k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
httpie/cli 的其他 Issue
-
A JSON body that starts with a brace can be parsed from the middle可能已有人在做 @SashaMIT 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
-
Header formatting reorders repeated fields with mixed capitalization可能已有人在做 @xu91102 于 13 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
JSON formatting ignores uppercase and mixed-case Content-Type values可能已有人在做 @xu91102 于 13 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
-
new
难度 2/5 1-3 小时 新手友好度 70/100
-
Bug: Windows guard in is_available() compares os.system (a function) to 'nt' — always False可能已有人在做 @yoshibase 于 86 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
相似的 Issue
-
enhancement good first issue Stellar Wave trivial
难度 2/5 1-3 小时 新手友好度 75/100
StellarCanary/ProtocolCanary-Fixtures#258 ·
维护者通常 1 天内回复
-
github_actions
难度 2/5 1-3 小时 新手友好度 65/100
Hochfrequenz/aibap.mcp#578 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
mishraprafful/multihull#150 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
python-caldav/caldav#735 ·
维护者通常 1 天内回复