AuthClient unconditionally makes http request on initialization
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- api, authentication
Hướng nghiên cứu
Bắt đầu trong intuitlib/client.py tại get_discovery_doc và luồng khởi tạo AuthClient được mô tả trong issue. So sánh các client PHP, Node và Ruby được tham chiếu để hiểu cách biểu diễn các URL OAuth mà không cần yêu cầu khởi tạo. Hoàn thành khi việc khởi tạo AuthClient không còn yêu cầu phản hồi mạng, trong khi các URL OAuth vẫn khả dụng cho bên gọi; hãy xác định hoặc thêm các test liên quan đến việc khởi tạo offline và thời điểm gửi request.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 86
- Fork
- 59
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của intuit/oauth-pythonclient
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
intuit/oauth-pythonclient#56 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
intuit/oauth-pythonclient#52 ·
-
input Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
intuit/oauth-pythonclient#55 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
intuit/oauth-pythonclient#47 · 1 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
intuit/oauth-pythonclient#38 · 3 bình luận ·
Tất cả issue của intuit/oauth-pythonclient
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
canonical/paas-charm#368 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
tech debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
addition to tracking list Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
StevenBlack/hosts#3256 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
qualcomm/qai-appbuilder#275 ·