电子邮件营销软件
getresponse-python的Python项目详细描述
获取响应
getresponse是用python编写的getresponse的api包装器。
安装
pip install getresponse-python
用法
from getresponse.client import GetResponse
from getresponse.excs import UniquePropertyError
getresponse = GetResponse('YOUR_API_KEY_HERE')
对于GetResponse企业平台:
from getresponse.client import GetResponseEnterprise
getresponse = GetResponseEnterprise('YOUR_API_KEY_HERE', 'YOUR_DOMAIN_NAME', 'YOUR_API_ENDPOINT')
获取帐户信息:
account = getresponse.accounts()
print('Account:', account.id, account.name)
获取所有活动:
campaigns = getresponse.get_campaigns({'sort': {'name', 'desc'}})
for campaign in campaigns:
print('Campaign:' campaign.id, campaign.name)
获得活动:
campaign = getresponse.get_campaign('CAMPAIGN_ID_HERE')
print('Campaign:', campaign.id, campaign.name)
创建活动:
campaign = {
"name": 'UNIQUE_ID_HERE',
}
try:
campaign = getresponse.create_campaign(campaign)
print('Campaign:', campaign.id, campaign.name)
except UniquePropertyError:
print("Cannot create: campaign's name already exists.")
获取所有联系人:
contacts = getresponse.get_contacts({'sort': {'name', 'desc'})
for contact in contacts:
print('Contact:', contact.id, contact.name)
联系:
contact = getresponse.get_contact('CONTACT_ID_HERE')
if contact:
print('Contact:', contact.id, contact.name)
创建联系人:
values = {
"email": "CONTACT_EMAIL_HERE",
"campaign": {
'campaignId': 'CAMPAIGN_ID_HERE',
},
}
try:
contact = getresponse.create_contact(values)
print('Contact in queue to be created.')
except UniquePropertyError:
print("Cannot created: contact's email already exists.")
删除联系人:
contact = getresponse.delete_contact('CONTACT_ID_HERE')
获取所有自定义字段:
custom_fields = getresponse.get_custom_fields({'sort': {'name', 'desc'})
for custom_field in custom_fields:
print('Custom Field:', custom_field.id, custom_field.name)
获取自定义字段:
custom_field = getresponse.get_custom_field('CUSTOM_FIELD_ID_HERE')
if custom_field:
print('Custom Field:', custom_field.id, custom_field.name)
要求
- 请求
贡献
我们总是感谢任何形式的贡献,包括但不限于错误报告、代码增强、错误修复,甚至功能建议。
您可以报告您发现的任何错误,或使用新的issue建议新功能。
如果您想为包装添加一些功能:
- 分叉(https://github.com/GearPlug/getresponse-python)
- 创建您的功能分支(git checkout-b我的新功能)
- 提交更改(git commit-am'添加我的新功能')
- 推到分支(git push origin我的新功能)
- 创建新的拉取请求