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


Python MailSnake.list方法代碼示例

本文整理匯總了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)})
開發者ID:danieka,項目名稱:churchplanner,代碼行數:26,代碼來源:views.py

示例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)
開發者ID:tyc,項目名稱:weather_by_email,代碼行數:31,代碼來源:get_data.py

示例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
    
開發者ID:tyc,項目名稱:weather_by_email,代碼行數:19,代碼來源:mailchimp.py


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