This is even more strange to me now:
I can run the example code from the post you link to just fine, I get no errors:
Code: Select all
from PySide2.QtNetwork import *
from PySide2.QtCore import *
mgr = QNetworkAccessManager()
reply = mgr.get(QNetworkRequest(QUrl("https://ipinfo.io/ip")));
reply.error()
content = reply.readAll()
content.data()
(EDIT: Actually, that's wrong, I don't know where they went the first time, but I
do get the same SSL errors on the mgr.get call)
That is
very similar to the code I'm trying to put into the AddonManager! All I've done is split it up to allow me to enqueue a whole bunch of requests and let the QNAM do async downloading.
Code: Select all
download_queue = QtNetwork.QNetworkAccessManager()
for repo in self.repos:
downloader = MetadataDownloadWorker(None, repo)
downloader.start_fetch(download_queue)
Where
MetadataDownloadWorker looks like:
Code: Select all
class MetadataDownloadWorker(QObject):
def __init__(self, parent, repo):
super().__init__(parent)
self.repo = repo
self.request = QtNetwork.QNetworkRequest(QtCore.QUrl(self.repo[1]))
def start_fetch(self, network_manager):
self.fetch_task = network_manager.get(self.request)
self.fetch_task.finished.connect(self.resolve_fetch)
self.fetch_task.errorOccurred.connect(self.fetch_failed)