本文整理匯總了Python中qgis.core.QgsNetworkContentFetcher類的典型用法代碼示例。如果您正苦於以下問題:Python QgsNetworkContentFetcher類的具體用法?Python QgsNetworkContentFetcher怎麽用?Python QgsNetworkContentFetcher使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了QgsNetworkContentFetcher類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testFetchBadUrl
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
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
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
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