AuthClient unconditionally makes http request on initialization
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- api, authentication
Research direction
Start in intuitlib/client.py at get_discovery_doc and the AuthClient initialization path described in the issue. Compare the referenced PHP, Node, and Ruby clients to understand how OAuth URLs are represented without an initialization request. Done means AuthClient initialization no longer requires a network response, while the OAuth URLs remain available to callers; identify or add relevant tests for offline initialization and request timing.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 86
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from intuit/oauth-pythonclient
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
intuit/oauth-pythonclient#56 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
intuit/oauth-pythonclient#52 ·
-
input Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
intuit/oauth-pythonclient#55 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
intuit/oauth-pythonclient#47 · 1 comment · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 20/100
intuit/oauth-pythonclient#38 · 3 comments ·
All issues in intuit/oauth-pythonclient
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
canonical/paas-charm#368 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
StevenBlack/hosts#3256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
qualcomm/qai-appbuilder#275 ·