本文整理汇总了Python中mailsnake.MailSnake.list方法的典型用法代码示例。如果您正苦于以下问题:Python MailSnake.list方法的具体用法?Python MailSnake.list怎么用?Python MailSnake.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailsnake.MailSnake
的用法示例。
在下文中一共展示了MailSnake.list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_mailchimp_users
# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import list [as 别名]
def get_mailchimp_users(request):
list_id = "63c4d992d8"
try:
m = MailSnake('c1ef033d26e799af744c00edc821634b-us8', api='export')
members = m.list(id=list_id)
# except mailchimp.ListDoesNotExistError:
# messages.error(request, "The list does not exist")
# return redirect('/')
except mailchimp.Error as e:
print(request, 'An error occurred: %s - %s' % (e.__class__, e))
return redirect('/')
new_users = 0
for member in members[1:]:
if len(User.objects.filter(email = member[0])) == 0 and len(User.objects.filter(username = member[1] + "." + member[2])) == 0:
new_user = User.objects.create_user(username=member[1] + "." + member[2], email=member[0])
new_user.first_name = member[1]
new_user.last_name = member[2]
new_user.save()
new_users += 1
return render(request, 'confirmation.html', {'text': "Antal nya användare: %d" % (new_users)})
示例2: MailSnake
# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import list [as 别名]
if options.country == None:
options.country = "Germany"
if options.town == None:
options.town = "Leichlingen"
if options.email == None:
options.email = "[email protected]"
# get the list of email addresses
opts = {'stream': True}
export = MailSnake('7726f9f014ed1511f11722f300bbbd43-us9', api='export', requests_opts=opts)
subscribers_list = export.list(id='1b1f1ee8be')
lines = 0
for list_member in subscribers_list():
if lines > 0: # skip header row
options.email = list_member[0]
options.town = list_member[1]
options.country = list_member[2]
location = str(options.town) + "," + str(options.country)
current_temp_url = "http://api.openweathermap.org/data/2.5/weather?APPID=ea2609c80dcead10bc52f803ff53eaa8&q="+str(location);
current_temp_json_obj = get_json_data(current_temp_url)
print time.strftime("%Y%m%d-%H%M%S") + ' Processing for weather data for ' + str(options.email) + ' for ' + str(location)
示例3: MailSnake
# 需要导入模块: from mailsnake import MailSnake [as 别名]
# 或者: from mailsnake.MailSnake import list [as 别名]
#!/usr/bin/python
from mailsnake import MailSnake
import json
opts = {'stream': True}
export = MailSnake('7726f9f014ed1511f11722f300bbbd43-us9', api='export', requests_opts=opts)
resp = export.list(id='1b1f1ee8be')
lines = 0
for list_member in resp():
if lines > 0: # skip header row
print list_member[0]
print list_member[1]
print list_member[2]
lines += 1