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


Python QNetworkRequest.setSslConfiguration方法代码示例

本文整理汇总了Python中PyQt4.QtNetwork.QNetworkRequest.setSslConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Python QNetworkRequest.setSslConfiguration方法的具体用法?Python QNetworkRequest.setSslConfiguration怎么用?Python QNetworkRequest.setSslConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtNetwork.QNetworkRequest的用法示例。


在下文中一共展示了QNetworkRequest.setSslConfiguration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: request

# 需要导入模块: from PyQt4.QtNetwork import QNetworkRequest [as 别名]
# 或者: from PyQt4.QtNetwork.QNetworkRequest import setSslConfiguration [as 别名]
    def request(self, iri, method="GET", extra_headers=None,
                oauth_credentials=None, post_content=None):
        """Return a deferred that will be fired with a Response object."""
        uri = self.iri_to_uri(iri)
        request = QNetworkRequest(QUrl(uri))
        request.setSslConfiguration(self.ssl_config)
        headers = yield self.build_request_headers(uri, method, extra_headers,
                                                   oauth_credentials)

        for key, value in headers.items():
            request.setRawHeader(key, value)

        post_buffer = QBuffer()
        post_buffer.setData(post_content)
        try:
            result = yield self._perform_request(request, method, post_buffer)
        except ProxyUnauthorizedError as e:
            app_proxy = QNetworkProxy.applicationProxy()
            proxy_host = app_proxy.hostName() if app_proxy else "proxy server"
            got_creds = yield self.request_proxy_auth_credentials(
                                            proxy_host, self.proxy_retry)
            if got_creds:
                self.proxy_retry = True
                result = yield self.request(iri, method, extra_headers,
                                            oauth_credentials, post_content)
            else:
                excp = WebClientError('Proxy creds needed.', e)
                defer.returnValue(excp)
        defer.returnValue(result)
开发者ID:ArslanRafique,项目名称:dist-packages,代码行数:31,代码来源:qtnetwork.py


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