本文整理汇总了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()