AuthClient unconditionally makes http request on initialization
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- api, authentication
Direzione di ricerca
Inizia in intuitlib/client.py, in get_discovery_doc e nel percorso di inizializzazione di AuthClient descritto nell’issue. Confronta i client PHP, Node e Ruby menzionati per capire come vengono rappresentati gli URL OAuth senza una richiesta di inizializzazione. Il lavoro è completato quando l’inizializzazione di AuthClient non richiede più una risposta di rete, mentre gli URL OAuth rimangono disponibili per i chiamanti; individua o aggiungi i test pertinenti per l’inizializzazione offline e la tempistica delle richieste.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 86
- Fork
- 59
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di intuit/oauth-pythonclient
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
intuit/oauth-pythonclient#56 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
intuit/oauth-pythonclient#52 ·
-
input Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
intuit/oauth-pythonclient#55 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
intuit/oauth-pythonclient#47 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
intuit/oauth-pythonclient#38 · 3 commenti ·
Tutte le issue di intuit/oauth-pythonclient
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
canonical/paas-charm#368 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
addition to tracking list Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
StevenBlack/hosts#3256 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
qualcomm/qai-appbuilder#275 ·