本文整理匯總了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
示例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
示例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
示例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