Skip to content

Commit 43135c4

Browse files
authored
Merge pull request #3248 from markotoplak/fix-doc-redir
[FIX] Documentation fetching with redirects
2 parents 958934e + 4a9fee6 commit 43135c4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Orange/canvas/help/provider.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ def _fetch_inventory(self, url):
6161
manager.setCache(cache)
6262
req = QNetworkRequest(url)
6363

64+
# Follow redirects (for example http -> https)
65+
# If redirects were not followed, the documentation would not be found
66+
try:
67+
req.setAttribute(QNetworkRequest.FollowRedirectsAttribute, 1) # from Qt 5.6
68+
req.setAttribute(QNetworkRequest.RedirectPolicyAttribute, # from Qt 5.9
69+
QNetworkRequest.NoLessSafeRedirectPolicy)
70+
except AttributeError: # if ran with earlier Qt
71+
pass
72+
6473
self._reply = manager.get(req)
6574
manager.finished.connect(self._on_finished)
6675
else:

0 commit comments

Comments
 (0)