You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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-pythonimportosfromsendgridimportSendGridAPIClientfromsendgrid.helpers.mailimportMailfromsendgrid.helpers.mail.tracking_settingsimportTrackingSettingsfromsendgrid.helpers.mail.ganalyticsimportGanalyticsmessage=Mail(
from_email='[email protected]',
to_emails='[email protected]',
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_settingssg=SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
response=sg.send(message)
print(response.status_code)
print(response.body)
print(response.headers)
exceptExceptionase:
print(e.message)
Either the module should enforce the use of the Utm_ modules, or check for the presence of primitive str types.
Issue Summary
When sending a message that contains a
Ganalytics
member of aTrackingSettings
object,sg.send()
makes calls to.get()
to build the associated JSON data. This results in a.get()
call being made on theGanalytics
members, some of which are the primitivestr
type 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 primitivestr
types.Technical details:
The text was updated successfully, but these errors were encountered: