本文整理匯總了Python中candidate.models.CandidateCampaignManager.update_candidate_twitter_details方法的典型用法代碼示例。如果您正苦於以下問題:Python CandidateCampaignManager.update_candidate_twitter_details方法的具體用法?Python CandidateCampaignManager.update_candidate_twitter_details怎麽用?Python CandidateCampaignManager.update_candidate_twitter_details使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類candidate.models.CandidateCampaignManager
的用法示例。
在下文中一共展示了CandidateCampaignManager.update_candidate_twitter_details方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: refresh_twitter_candidate_details
# 需要導入模塊: from candidate.models import CandidateCampaignManager [as 別名]
# 或者: from candidate.models.CandidateCampaignManager import update_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