當前位置: 首頁>>代碼示例>>Python>>正文


Python QgsNetworkContentFetcher.reply方法代碼示例

本文整理匯總了Python中qgis.core.QgsNetworkContentFetcher.reply方法的典型用法代碼示例。如果您正苦於以下問題:Python QgsNetworkContentFetcher.reply方法的具體用法?Python QgsNetworkContentFetcher.reply怎麽用?Python QgsNetworkContentFetcher.reply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qgis.core.QgsNetworkContentFetcher的用法示例。


在下文中一共展示了QgsNetworkContentFetcher.reply方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testFetchBadUrl

# 需要導入模塊: from qgis.core import QgsNetworkContentFetcher [as 別名]
# 或者: from qgis.core.QgsNetworkContentFetcher import reply [as 別名]
    def testFetchBadUrl(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://x'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            app.processEvents()

        r = fetcher.reply()
        assert r.error() != QNetworkReply.NoError
開發者ID:,項目名稱:,代碼行數:12,代碼來源:

示例2: testFetchUrlContent

# 需要導入模塊: from qgis.core import QgsNetworkContentFetcher [as 別名]
# 或者: from qgis.core.QgsNetworkContentFetcher import reply [as 別名]
    def testFetchUrlContent(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://localhost:' + str(TestQgsNetworkContentFetcher.port) + '/qgis_local_server/index.html'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            app.processEvents()

        r = fetcher.reply()
        assert r.error() == QNetworkReply.NoError, r.error()

        html = fetcher.contentAsString()
        assert 'QGIS' in html
開發者ID:,項目名稱:,代碼行數:15,代碼來源:

示例3: testFetchEncodedContent

# 需要導入模塊: from qgis.core import QgsNetworkContentFetcher [as 別名]
# 或者: from qgis.core.QgsNetworkContentFetcher import reply [as 別名]
    def testFetchEncodedContent(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://localhost:' + str(TestQgsNetworkContentFetcher.port) + '/encoded_html.html'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            app.processEvents()

        r = fetcher.reply()
        assert r.error() == QNetworkReply.NoError, r.error()

        html = fetcher.contentAsString()
        assert chr(6040) in html
開發者ID:,項目名稱:,代碼行數:15,代碼來源:

示例4: testDoubleFetch

# 需要導入模塊: from qgis.core import QgsNetworkContentFetcher [as 別名]
# 或者: from qgis.core.QgsNetworkContentFetcher import reply [as 別名]
    def testDoubleFetch(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://www.qgis.org/'))
        # double fetch - this should happen before previous request finishes
        fetcher.fetchContent(QUrl('http://localhost:' + str(TestQgsNetworkContentFetcher.port) + '/qgis_local_server/index.html'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            app.processEvents()

        r = fetcher.reply()
        assert r.error() == QNetworkReply.NoError, r.error()

        html = fetcher.contentAsString()
        assert 'QGIS' in html
開發者ID:,項目名稱:,代碼行數:17,代碼來源:


注:本文中的qgis.core.QgsNetworkContentFetcher.reply方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。