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


Python Dropbox.get_budget_file方法代碼示例

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


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

示例1: post

# 需要導入模塊: from dropbox import Dropbox [as 別名]
# 或者: from dropbox.Dropbox import get_budget_file [as 別名]
    def post(self):
        method_start = time.clock()
        flask_app.logger.info("Comparing budgets")

        json = request.get_json()
        token = json['access_token']
        this_budget_path = json['this_budget_path']
        other_budget_path = json['other_budget_path']

        db = Dropbox(token)

        start = time.clock()
        this_json = db.get_budget_file(this_budget_path)
        end = time.clock()
        elapsed = end - start
        flask_app.logger.debug("Get this budget time elapsed: {time}s".format(time=elapsed))

        start = time.clock()
        other_json = db.get_budget_file(other_budget_path)
        end = time.clock()
        elapsed = end - start
        flask_app.logger.debug("Get other budget time elapsed: {time}s".format(time=elapsed))

        this_target_category = json['this_target_category']
        other_target_category = json['other_target_category']

        start_date = json['comparison_start_date']

        comparer = YnabBudgetComparer(this_json, this_target_category, other_json, other_target_category)
        comparer.set_start_date(start_date)

        start = time.clock()
        missing_txns = comparer.get_missing_transactions()
        end = time.clock()
        flask_app.logger.debug("Find missing transactions time elapsed: {time}s".format(time=(end - start)))

        method_finish = time.clock()
        method_elapsed = method_finish - method_start
        flask_app.logger.info("Finished comparing budgets. Time elapsed: {time}s".format(time=method_elapsed))

        this_payees = comparer.get_this_payees()
        other_payees = comparer.get_other_payees()

        return {"this_missing": missing_txns[0], "other_missing": missing_txns[1],
                "this_payees": this_payees, "other_payees": other_payees}
開發者ID:juanpescador,項目名稱:ynabdebtsync,代碼行數:47,代碼來源:api.py


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