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


Python CandidateCampaignManager.clear_candidate_twitter_details方法代碼示例

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


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

示例1: refresh_twitter_candidate_details

# 需要導入模塊: from candidate.models import CandidateCampaignManager [as 別名]
# 或者: from candidate.models.CandidateCampaignManager import clear_candidate_twitter_details [as 別名]
def refresh_twitter_candidate_details(candidate_campaign):
    candidate_campaign_manager = CandidateCampaignManager()

    if not candidate_campaign:
        status = "TWITTER_CANDIDATE_DETAILS_NOT_RETRIEVED-CANDIDATE_MISSING"
        results = {
            'success':                  False,
            'status':                   status,
        }
        return results

    if candidate_campaign.candidate_twitter_handle:
        status = "TWITTER_CANDIDATE_DETAILS-REACHING_OUT_TO_TWITTER"
        results = retrieve_twitter_user_info(candidate_campaign.candidate_twitter_handle)

        if results['success']:
            status = "TWITTER_CANDIDATE_DETAILS_RETRIEVED_FROM_TWITTER"
            save_results = candidate_campaign_manager.update_candidate_twitter_details(
                candidate_campaign, results['twitter_json'])
    else:
        status = "TWITTER_CANDIDATE_DETAILS-CLEARING_DETAILS"
        save_results = candidate_campaign_manager.clear_candidate_twitter_details(candidate_campaign)

    results = {
        'success':                  True,
        'status':                   status,
    }
    return results
開發者ID:josephevans,項目名稱:WeVoteServer,代碼行數:30,代碼來源:controllers.py


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