How to get Campaign Monitor Transactional Emails sent -using Python and CreateSend?

247 Views Asked by At

I'm using the createsend library to try to establish a connection with my Campaign Monitor account. I'd like to count and monitor the emails sent over time to all users. But in trying to use the api key assigned to the user I log-in as, I get an error.

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

Error:

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

Does this api key need to be of each specific user I'm sending to and not as the one I'm logging in as? If so, how can I automate using my log-in api key to get all the keys I need for all users...to then get the end product of monitoring emails sent over time?

Documentation used:

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

1

There are 1 best solutions below

0
Vishnoo Srinath On

You have to provide your client ID:

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