本文整理匯總了Python中Engine.Engine.makeQuery方法的典型用法代碼示例。如果您正苦於以下問題:Python Engine.makeQuery方法的具體用法?Python Engine.makeQuery怎麽用?Python Engine.makeQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Engine.Engine
的用法示例。
在下文中一共展示了Engine.makeQuery方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __ProviderManager
# 需要導入模塊: from Engine import Engine [as 別名]
# 或者: from Engine.Engine import makeQuery [as 別名]
class __ProviderManager(QtCore.QObject):
sendError = QtCore.pyqtSignal(str)
def __init__(self):
QtCore.QObject.__init__(self)
self.providers = {}
self.poolManager = PoolManager(timeout=Timeout(10),
headers={'Accept-Encoding': 'gzip,deflate'})
self.engine = Engine()
def loadProviderFromFile(self,path):
try:
providerFile = open(path,mode="r")
provider = json.loads(providerFile.read())
providerFile.close()
self.providers[provider["name"]] = provider
except Exception as e:
self.sendError.emit("cannot load provider at '"+path+"' <br/><b>Reason:</b> "+str(e))
def loadProviderFromUrl(self,url):
try:
req = self.poolManager.request("GET", url)
provider = json.loads(req.data.decode('utf-8'))
self.providers[provider["name"]] = provider
del req
except Exception as e:
self.sendError.emit("cannot load provider at '"+url+"' <br/><b>Reason:</b> "+str(e))
def queryProvider(self,text,category,pages,providerName,perPageCallback=None,whenDoneCallback=None):#Exceptions here should be managed by the caller
return self.engine.makeQuery(self.providers[providerName], text, category, pages,perPageCallback,whenDoneCallback)
def reset(self):
if self.providers:
self.providers.clear()