Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

AuthClient unconditionally makes http request on initialization

Aperta
#18 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di intuit/oauth-pythonclient

Tutte le issue di intuit/oauth-pythonclient

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.