当前位置: 首页>>代码示例>>Python>>正文


Python QNetworkRequest.CacheLoadControl方法代码示例

本文整理汇总了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()
开发者ID:waitingzeng,项目名称:GRobot,代码行数:38,代码来源:grobot.py


注:本文中的PyQt4.QtNetwork.QNetworkRequest.CacheLoadControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。