当前位置: 首页>>代码示例>>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;未经允许,请勿转载。