AuthClient unconditionally makes http request on initialization
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- api, authentication
调研方向
从 intuitlib/client.py 中的 get_discovery_doc 以及 issue 所述的 AuthClient 初始化路径开始。比较所引用的 PHP、Node 和 Ruby 客户端,以了解如何在不发起初始化请求的情况下表示 OAuth URL。完成的标准是 AuthClient 初始化不再需要网络响应,同时 OAuth URL 仍可供调用方使用;请识别或添加与离线初始化和请求时机相关的测试。
由索引模型根据 Issue 内容生成。
描述
Whenever you initialize an instance of AuthClient it calls get_discovery_doc which will issue a request to the intuit site.
This is inconvenient when running tests if the AuthClient is initialized at any point, even if it is not directly used:
- Drastically slows down each test due to waiting on a response for the discovery document.
- Adds an implicit dependency on one's internet connection as the affected tests will fail without one
If you want to avoid this performance penalty then you must mock the AuthClient in any test that might incidentally initialize an instance of it. In my case I was testing out an integration with quickbooks using the community python sdk and this caused my test suite to go from taking ~15s to about 1m17s.
This also means that if you have a view that redirects a user to the OAuth authorization url then your response timing will be dependent on the time for the discovery document to be retrieved.
Looking at the other intuit oauth client library, it looks like there is a split on retrieving the urls from the discovery document and storing the urls as constants in the library. The .NET and Java libraries both require you to make a request to the discovery document to get the OAuth urls whereas the PHP, Node, and Ruby libraries have them stored as constants.
From my perspective, it seems strictly better to store the urls as constants in the library as it removes any performance penalty that occurs from having to wait for a http response to retrieve the discovery doc when initializing the client.
- 主要语言
- Python
- 星标
- 86
- 派生
- 59
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
intuit/oauth-pythonclient 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
intuit/oauth-pythonclient#56 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
intuit/oauth-pythonclient#52 ·
-
input 未关闭
难度 5/5 一周以上 新手友好度 10/100
intuit/oauth-pythonclient#55 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
intuit/oauth-pythonclient#47 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 20/100
intuit/oauth-pythonclient#38 · 3 条评论 ·
查看 intuit/oauth-pythonclient 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·