[PyQt] QWebView and https
alanm
me at alandmoore.com
Thu May 27 15:59:35 BST 2010
On Monday 10 May 2010 10:47:58 pm alan moore wrote:
> After being fed up with the kiosk modes offered by various browsers, I'm
> taking another crack at writing my own minimal browser with pyqt and
> QtWebKit for a kiosk application.
>
> Everything is working great, and I'm able to get all the features I want
> from this set up. But there is a problem. One of the sites I have to
> display is https://, and though the certificate is registered with a CA
> (starfield), it seems not all browsers recognize the CA and QtWebKit is
> one of them.
>
> As a result, because the certificate is being rejected, the page never
> loads.
>
> Bottom line: I need to tell the QWebView.load() method to either accept
> this certificate, or ignore certificate errors altogether. I know this
> can be done, but after spending half the day reading through incomplete
> documentation I can't figure out how.
>
> Can anyone provide or point me to an example of how this is done?
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Well, despite no replies I haven't given up. What I've found is that I'll
need to create my own class based on QNetworkAccessManager and override the
sslErrors() method. Here's the class I am trying:
class myNetworkManager(QNetworkAccessManager):
"""Implemented to override certain aspects of the network access, such as
SSL certificate errors"""
def __init__(self, parent=None):
super(QNetworkAccessManager, self).__init__(parent)
def sslErrors(reply, errors):
reply.ignoreSslErrors()
Now what I don't understand is how to make my QWebView use this class. I know
that QWebPage has a setNetworkAccessManager() method, but I've tried various
ways to connect these bits and nothing works yet.
Do I have to subclass QWebPage or QWebView ?
More information about the PyQt
mailing list