[PyQt] QWebView and https

alanm me at alandmoore.com
Thu May 27 16:59:52 BST 2010


On Thursday 27 May 2010 10:41:08 am David Boddie wrote:

> You should just be able to set the network access manager on the QWebPage
> returned by the QWebView's page() method. I don't know if this will do
> everything you need.
> 
> I'm curious about the need to subclass QNetworkAccessManager. I would have
> thought that simply connecting the sslErrors signal to a slot and calling
> the ignoreSslErrors() method of the QNetworkReply object passes to it would
> do what you need. Reimplementing the sslErrors signal in a subclass may not
> work as you might expect.

David, thanks for your response.  I've tried both of these approaches, and so 
far nothing works.  What's really frustrating is it just fails silently, never 
loading the page, so I'm not sure where I'm going wrong.

I got the approach of subclassing QNetworkAccessManager from trying to make 
sense of the arora sourcecode with my limited c++ comprehension.  I'm open to 
any suggestion, as long as I can make it work; if my approach seems strange 
it's because I'm flailing around ineptly looking for an answer. :-)

Here's the code I tried based on your second suggestion:

        self.connect (self.myWebview.page().networkAccessManager(), 
SIGNAL("sslErrors(QNetworkReply, QList)"), self.sslErrorHandler)

    def sslErrorHandler(self, reply, errorList):
        reply.ignoreSslErrors()
        print errorList
        return

Is that correct?  The first statement is called in the __init__() function of 
the mainwindow widget, self.myWebview is just a QWebView().

I would be extremely grateful if anyone could provide a simple working 
example.


More information about the PyQt mailing list