在Mailchimp API 1.3中,您可以使用以下步骤在群组中列出订阅:
import requests
api_key = 'your_api_key'
dc = api_key.split('-')[1]
list_id = 'your_list_id'
url = f'https://{dc}.api.mailchimp.com/3.0/lists/{list_id}/members'
headers = {
'Authorization': f'apikey {api_key}',
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
members = response.json()['members']
for member in members:
print(member['email_address'])
else:
print('Error:', response.status_code)
your_api_key
替换为您的Mailchimp API密钥,并将your_list_id
替换为您要列出订阅的邮件列表ID。请注意,Mailchimp API 1.3已被弃用,建议您使用Mailchimp API 3.0。
领取专属 10元无门槛券
手把手带您无忧上云