[PyQt] QHttp setProxy error

Mladen Milankovic mmlado at gmail.com
Mon Jun 16 17:45:55 BST 2008


Hi.

I'm new to this list and new to Python and Qt.
I have a problem with QHttp and proxies. 
I need to get pages from the web through anonymous proxies. I've written a 
little script but I have a problem whenewer I use QHttp-s setProxy. 
I tried it using directly and through QNetworkProxy, but I always get a proxy 
error.

Here's the code:

import sys
from PyQt4.QtCore import *
from PyQt4.QtNetwork import QHttp, QNetworkProxy

def process(error):
  if not error:
    content = unicode(QString(page.readAll()))
    print content
  else:
    print "errors occured"
    print str(page.errorString())
  quit()

if __name__ == "__main__":
  app = QCoreApplication (sys.argv)
  proxy = QNetworkProxy(QNetworkProxy.HttpProxy, '69.217.73.52', 8080)
  page = QHttp(None)
  QObject.connect(page, SIGNAL("done(bool)"), process);
  page.setHost('trolltech.com')
  page.setProxy(proxy)
  gprocId = page.get('/')
  sys.exit (app.exec_ ())

And the error message:

UNEXPECTED RESPONSE: [HTTP/1.1 502 Proxy Error ( The specified Secure Sockets 
Layer (SSL) port is not allowed. ISA Server is not configured to allow SSL 
requests from this port. Most Web browsers use port 443 for SSL requests. )
Via: 1.1 PIKEISAEXT
Connection: close
Proxy-Connection: close
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 777

]
UNEXPECTED RESPONSE: [HTTP/1.1 502 Proxy Error ( The specified Secure Sockets 
Layer (SSL) port is not allowed. ISA Server is not configured to allow SSL 
requests from this port. Most Web browsers use port 443 for SSL requests. )
Via: 1.1 PIKEISAEXT
Connection: close
Proxy-Connection: close
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 777

]
errors occured
HTTP request failed

I think the problem is the request is sent through ssl, but I didn't tell him 
to do that. I explicitly told him to use normal communication.

Thanx in advance
regards
mmlado


More information about the PyQt mailing list