[PyQt] QHttp-request not finished

Jan Holthuis jan at holmek.de
Mon Aug 18 19:19:25 BST 2008


Hello!
I have a problem regarding QtNetwork.QHttp. It doesn't finish the GET-request, 
although all request have been started (you can see this if you replace the  
requestFinished-Signal with requestStarted).

The output of the script below is:
REQ: 3
FRID = 1
FRID = 2
This means that request 3 is the GET-Request, but only 1 (setProxy I think) 
and 2 (setHost) are finished.

I simply don't know the reason...Is it a bug in PyQt or did I make a mistake?
Thanks in advance,
Jan Holthuis

# CODE STARTS HERE
import sys
from PyQt4 import QtCore, QtGui, QtNetwork

class test(QtGui.QWidget):
	def __init__(self):
		QtGui.QWidget.__init__(self)
		self.httpo = QtNetwork.QHttp()
		self.httpo.setProxy("server",3128,"user","pass")
		self.httpo.setHost("www.google.de")
		self.req_id = self.httpo.get("/images/nav_logo3.png")
		print "REQ: "+str(self.req_id)
		self.connect(self.httpo, QtCore.SIGNAL("requestFinished(int, bool)"), 
self.request_finished)
	def request_finished(self,id):
		print "FRID = "+str(id)
		error = False
		if not self.httpo.hasPendingRequests():
			print "FINISHED"
		if self.req_id == id:
			if error:
				print "Error: "+self.httpo.errorString()
			else:
				print "Success"
				print self.httpo.readAll()
app = QtGui.QApplication(sys.argv)
test = test()
test.show()
sys.exit(app.exec_())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080818/152def2e/attachment.bin


More information about the PyQt mailing list