AuthClient unconditionally makes http request on initialization
まだ誰も着手していません。
評価
- 難易度
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 10/100
intuit/oauth-pythonclient#55 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
intuit/oauth-pythonclient#47 · コメント 1 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 20/100
intuit/oauth-pythonclient#38 · コメント 3 件 ·
intuit/oauth-pythonclient の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
canonical/paas-charm#368 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
tech debt
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
StevenBlack/hosts#3256 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
qualcomm/qai-appbuilder#275 ·