本文整理汇总了Python中PyQt4.QtNetwork.QNetworkRequest.CacheLoadControl方法的典型用法代码示例。如果您正苦于以下问题:Python QNetworkRequest.CacheLoadControl方法的具体用法?Python QNetworkRequest.CacheLoadControl怎么用?Python QNetworkRequest.CacheLoadControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtNetwork.QNetworkRequest
的用法示例。
在下文中一共展示了QNetworkRequest.CacheLoadControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from PyQt4.QtNetwork import QNetworkRequest [as 别名]
# 或者: from PyQt4.QtNetwork.QNetworkRequest import CacheLoadControl [as 别名]
def open(self, address, method='get', headers=None, auth=None, body=None,
default_popup_response=None):
"""Opens a web page.
@param address: The resource URL.
@param method: The Http method.
@param headers: An optional dict of extra request hearders.
@param auth: An optional tupple of HTTP auth (username, password).
@param body: An optional string containing a payload.
@param default_popup_response: the default response for any confirm/
alert/prompt popup from the Javascript (replaces the need for the with
blocks)
"""
headers = headers or {}
body = body or QByteArray()
try:
method = getattr(QNetworkAccessManager,
"%sOperation" % method.capitalize())
except AttributeError:
raise Exception("Invalid http method %s" % method)
request = QNetworkRequest(QUrl(address))
request.CacheLoadControl = 0
for header in headers:
request.setRawHeader(header, headers[header])
self._auth = auth
self._auth_attempt = 0 # Avoids reccursion
self.page.mainFrame().load(request, method, body)
self._loaded = False
if default_popup_response is not None:
self._prompt_expected = (default_popup_response, None)
self._confirm_expected = (default_popup_response, None)
return self.wait_for_page_loaded()