I find the examples difficult to run because they are unclear on what is needed (specifically https://github.com/sendgrid/sendgrid-python/blob/master/examples/mail/mail.py).
All I am trying to do is send a simple email with one of my transactional email templates:
sg = sendgrid.SendGridAPIClient(apikey='mykey')
def send_email(to, template):
data = {
'from': {
'email': "welcome@mydomain.com",
'name': "Hello"
},
'personalizations': [{
'to': [
{
'email': "test@mydomain.com",
'name': "test"
}
]
}],
'subject': "Welcome ",
'template_id': "my template id"
}
response = sg.client.mail.send.post(request_body=data)
print(response.status_code)
print(response.body)
print(response.headers)
But this throws an attribute error:
AttributeError: class addinfourl has no attribute 'mro'
I find the examples difficult to run because they are unclear on what is needed (specifically https://github.com/sendgrid/sendgrid-python/blob/master/examples/mail/mail.py).
All I am trying to do is send a simple email with one of my transactional email templates:
But this throws an attribute error: