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


Python MOSES.getPiggyBankDataBetweenDates方法代碼示例

本文整理匯總了Python中MOSES.getPiggyBankDataBetweenDates方法的典型用法代碼示例。如果您正苦於以下問題:Python MOSES.getPiggyBankDataBetweenDates方法的具體用法?Python MOSES.getPiggyBankDataBetweenDates怎麽用?Python MOSES.getPiggyBankDataBetweenDates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MOSES的用法示例。


在下文中一共展示了MOSES.getPiggyBankDataBetweenDates方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getPiggyBankDataBetweenDates [as 別名]
    def run(self):
        self.mutex.unlock()
        current_data = []
        self.past_data = []
        while True:
            try:
                data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
            except:
                try:
                    time.sleep(self.sleeper)
                    data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
                except:
                    try:
                        time.sleep(self.sleeper)
                        data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
                    except:
                        try:
                            time.sleep(self.sleeper)
                            data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
                        except:
                            try:
                                time.sleep(self.sleeper)
                                data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
                            except:
                                raise

            cleaned_data = list(itertools.chain(*data))
            if cleaned_data != self.past_data:
                #print "Getting data for %s" %self.start_date
                #print "Emitting information!"
                #print "Sending %d articles." %len(cleaned_data)
                targets_data = []
                for entry in cleaned_data:
                    piggy_row = {
                        "Description Type": entry["Description Type"],
                        "Source": entry["Source"],
                        "BU": entry["BU"],
                        "Super-Category": entry["Super-Category"],
                        "Category": entry["Category"],
                        "Sub-Category": entry["Sub-Category"],
                        "Vertical": entry["Vertical"]
                    }
                    article_date = entry["Article Date"]
                    target = MOSES.getTargetFor(self.user_id, self.password, piggy_row, article_date, category_tree=self.category_tree)
                    targets_data.append(target)
                self.piggybankChanged.emit(cleaned_data, targets_data)
            self.past_data = cleaned_data
            self.sleeper = 10
        self.mutex.lock()
開發者ID:vinay87,項目名稱:oink,代碼行數:51,代碼來源:PiggyBanker.py

示例2: getPiggyBank

# 需要導入模塊: import MOSES [as 別名]
# 或者: from MOSES import getPiggyBankDataBetweenDates [as 別名]
 def getPiggyBank(self):
     #self.sleeper = sleeper
     data = MOSES.getPiggyBankDataBetweenDates(self.start_date, self.end_date, self.query_dict, self.user_id, self.password)
     cleaned_data = list(itertools.chain(*data))
     targets_data = []
     for entry in cleaned_data:
         piggy_row = {
                     "Description Type": entry["Description Type"],
                     "Source": entry["Source"],
                     "BU": entry["BU"],
                     "Super-Category": entry["Super-Category"],
                     "Category": entry["Category"],
                     "Sub-Category": entry["Sub-Category"],
                     "Vertical": entry["Vertical"]
                 }
         target = MOSES.getTargetFor(self.user_id, self.password, piggy_row, entry["Article Date"], category_tree=self.category_tree)
         targets_data.append(target)
     
     self.piggybankChanged.emit(cleaned_data, targets_data)
     
             
開發者ID:vinay87,項目名稱:oink,代碼行數:21,代碼來源:PiggyBanker.py


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