如何使用Python和CreateSend发送Campaign Monitor事务性电子邮件



我正在使用createsend库尝试与我的Campaign Monitor帐户建立连接。我想统计和监控发送给所有用户的电子邮件。但是,在尝试使用分配给我登录的用户的api密钥时,我遇到了一个错误。

!pip install createsend
from createsend import *
cs = CreateSend({'api_key': 'my_api_key'})
clients = cs.clients()

错误:

Unauthorized: The CreateSend API responded with the following error - 50: 
Must supply a valid HTTP Basic Authorization header

这个api密钥是否需要是我发送给的每个特定用户的,而不是我登录的那个用户?如果是这样的话,我如何自动使用我的登录api密钥来获得所有用户所需的所有密钥。。。然后获得监控电子邮件随时间发送的最终产品?

使用的文件:

https://github.com/campaignmonitor/createsend-python

https://help.createsend.com/admin/api-keys

https://github.com/campaignmonitor/createsend-python/blob/master/lib/createsend/transactional.py

您必须提供您的客户端ID:

client = Client(auth,ClientID) # auth will be your api key
auth = {'api_key': 'my_api_key'}

最新更新