Check blacklist when downloading Update.xml
@@ -24,8 +24,10 @@ import xml.etree.ElementTree as ElementTree
from logging import getLogger
import requests
+from requests.adapters import HTTPAdapter
+from urllib3 import Retry
-from aqt.helper import Settings
+from aqt.helper import Settings, altlink
class ArchiveConnectionError(Exception):
@@ -215,8 +217,17 @@ class QtArchives:
self._parse_update_xml(archive_url, target_packages)
def _download_update_xml(self, update_xml_url):
+ with requests.Session() as session:
+ retry = Retry(connect=5, backoff_factor=0.5)
+ adapter = HTTPAdapter(max_retries=retry)
+ session.mount("http://", adapter)
+ session.mount("https://", adapter)
try:
- r = requests.get(update_xml_url, timeout=self.timeout)
+ r = requests.get(update_xml_url, allow_redirects=False, timeout=self.timeout)
+ if r.status_code == 302:
+ newurl = altlink(r.url, r.headers["Location"], logger=self.logger)
+ self.logger.info("Redirected URL: {}".format(newurl))
+ r = session.get(newurl, stream=True, timeout=self.timeout)
except (
ConnectionResetError,
requests.exceptions.ConnectionError,
