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


Python Engine.makeQuery方法代碼示例

本文整理匯總了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() 
開發者ID:cr0wbar,項目名稱:fishnet,代碼行數:37,代碼來源:ProviderManager.py


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