Title: 'str' object has no attribute 'get()' · Issue #836 · sendgrid/sendgrid-python · GitHub
Open Graph Title: 'str' object has no attribute 'get()' · Issue #836 · sendgrid/sendgrid-python
X Title: 'str' object has no attribute 'get()' · Issue #836 · sendgrid/sendgrid-python
Description: 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, s...
Open Graph Description: 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...
X Description: 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...
Opengraph URL: https://github.com/sendgrid/sendgrid-python/issues/836
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"'str' object has no attribute 'get()'","articleBody":"#### Issue Summary\r\n\r\nWhen 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.](https://github.com/sendgrid/sendgrid-python/blob/610e933b8a829617583bdb5684d799c94020bebf/sendgrid/helpers/mail/ganalytics.py#L174)\r\n\r\n\r\n#### Steps to Reproduce\r\n\r\n1. run temp.py:\r\n```python\r\n# using SendGrid's Python Library\r\n# https://github.com/sendgrid/sendgrid-python\r\nimport os\r\nfrom sendgrid import SendGridAPIClient\r\nfrom sendgrid.helpers.mail import Mail\r\nfrom sendgrid.helpers.mail.tracking_settings import TrackingSettings\r\nfrom sendgrid.helpers.mail.ganalytics import Ganalytics\r\n\r\nmessage = Mail(\r\n from_email='from@example.com',\r\n to_emails='to@example.com',\r\n subject='Sending with Twilio SendGrid is Fun',\r\n html_content='\u003cstrong>and easy to do anywhere, even with Python\u003c/strong>')\r\ntry:\r\n tracking_settings = TrackingSettings()\r\n tracking_settings.ganalytics = Ganalytics(enable=True, utm_medium=\"email\")\r\n message.tracking_settings = tracking_settings\r\n sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))\r\n response = sg.send(message)\r\n print(response.status_code)\r\n print(response.body)\r\n print(response.headers)\r\nexcept Exception as e:\r\n print(e.message)\r\n```\r\n\r\nEither the module should enforce the use of the `Utm_` modules, or check for the presence of primitive `str` types.\r\n\r\n#### Technical details:\r\n\r\n* sendgrid-python Version: master (latest commit: 610e933b8a829617583bdb5684d799c94020bebf)\r\n* Python Version: 3.7.4","author":{"url":"https://github.com/eshanholtz","@type":"Person","name":"eshanholtz"},"datePublished":"2019-09-10T01:27:22Z","url":"https://github.com/sendgrid/sendgrid-python/issues/836"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:412782b0-6183-bb71-2869-5b4c7e816bb4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B798:2E9831:9DFEA9:D0FECE:6B01B874 |
| html-safe-nonce | 443883725f3b65bc75172687bdbb262cca4313c2d80af97a1a4526cf18d997b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzk4OjJFOTgzMTo5REZFQTk6RDBGRUNFOjZCMDFCODc0IiwidmlzaXRvcl9pZCI6IjMxMTkxMTMzMTM1Mjc2NDIyMjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3e6ccea7cc00fb4174ca3b95f925c26a0703a411444047b1d5b54098c635b397 |
| hovercard-subject-tag | issue:491400957 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sendgrid/sendgrid-python/836/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cf6fe624012a4cd3c367449ee90ff2310d6c642956fc37b2ff68300dea3d6f33/sendgrid/sendgrid-python/issues/836 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cf6fe624012a4cd3c367449ee90ff2310d6c642956fc37b2ff68300dea3d6f33/sendgrid/sendgrid-python/issues/836 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eshanholtz |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/sendgrid/sendgrid-python git https://github.com/sendgrid/sendgrid-python.git |
| octolytics-dimension-user_id | 181234 |
| octolytics-dimension-user_login | sendgrid |
| octolytics-dimension-repository_id | 3546794 |
| octolytics-dimension-repository_nwo | sendgrid/sendgrid-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3546794 |
| octolytics-dimension-repository_network_root_nwo | sendgrid/sendgrid-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width