本文整理汇总了Python中mailsnake.MailSnake.campaigns方法的典型用法代码示例。如果您正苦于以下问题:Python MailSnake.campaigns方法的具体用法?Python MailSnake.campaigns怎么用?Python MailSnake.campaigns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailsnake.MailSnake
的用法示例。
在下文中一共展示了MailSnake.campaigns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: campaign_info
# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import campaigns [as 别名]
def campaign_info(cid):
mc = MailSnake(settings.MC_API_KEY)
campaigns = mc.campaigns(filters = {"campaign_id": cid})
if campaigns['total'] == 0:
return 0
webid = campaigns['data'][0]['web_id']
title = campaigns['data'][0]['title']
region = settings.MC_API_KEY.split('-')[1]
url = "https://%s.admin.mailchimp.com/campaigns/show?id=%d" % (region, webid)
return title, url
示例2: campaign_info
# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import campaigns [as 别名]
def campaign_info(cid):
mc = MailSnake(settings.MC_API_KEY)
campaigns = mc.campaigns(filters={"campaign_id": cid})
if campaigns["total"] == 0:
return 0
webid = campaigns["data"][0]["web_id"]
title = campaigns["data"][0]["title"]
region = settings.MC_API_KEY.split("-")[1]
url = "https://%s.admin.mailchimp.com/campaigns/show?id=%d" % (region, webid)
return title, url