Issue Summary
When sending a message that contains a Ganalytics member of a TrackingSettings object, sg.send() makes calls to .get() to build the associated JSON data. This results in a .get() call being made on the Ganalytics members, some of which are the primitive str type and do not have the .get() method. The line causing the error can be found here.
Steps to Reproduce
- run temp.py:
# using SendGrid's Python Library
# https://github.com/sendgrid/sendgrid-python
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
from sendgrid.helpers.mail.tracking_settings import TrackingSettings
from sendgrid.helpers.mail.ganalytics import Ganalytics
message = Mail(
from_email='from@example.com',
to_emails='to@example.com',
subject='Sending with Twilio SendGrid is Fun',
html_content='<strong>and easy to do anywhere, even with Python</strong>')
try:
tracking_settings = TrackingSettings()
tracking_settings.ganalytics = Ganalytics(enable=True, utm_medium="email")
message.tracking_settings = tracking_settings
sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
response = sg.send(message)
print(response.status_code)
print(response.body)
print(response.headers)
except Exception as e:
print(e.message)
Either the module should enforce the use of the Utm_ modules, or check for the presence of primitive str types.
Technical details:
- sendgrid-python Version: master (latest commit: 610e933)
- Python Version: 3.7.4
Issue Summary
When sending a message that contains a
Ganalyticsmember of aTrackingSettingsobject,sg.send()makes calls to.get()to build the associated JSON data. This results in a.get()call being made on theGanalyticsmembers, some of which are the primitivestrtype and do not have the.get()method. The line causing the error can be found here.Steps to Reproduce
Either the module should enforce the use of the
Utm_modules, or check for the presence of primitivestrtypes.Technical details: