PDA

View Full Version : PyQt4: QNetworkDiskCache. Save images with attribute "no-cache"



rustamakhmetov
25th November 2011, 06:50
Who save images with attribute "no-cache" with use QNetworkDiskCache ?

PyQt4: 4.8.6
Python: 2.7
OS: WinXP 32bit



# coding: utf-8
import os,sys
from PyQt4.QtNetwork import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

app = QApplication(sys.argv)

manager = QNetworkAccessManager()
diskCache = QNetworkDiskCache()
diskCache.setCacheDirectory(os.path.join(os.getcwd (),"cache"))
manager.setCache(diskCache)

view = QWebView()
webpage = QWebPage()
view.setPage(webpage)

webpage.setNetworkAccessManager(manager)

url = "http://acmacolvia.info/img.php"
view.load(QUrl(url))
view.show()
app.exec_()
sys.exit()