Sendgrid-python: 'UnauthorizedError' object has no attribute 'message'

Created on 30 Apr 2019  路  11Comments  路  Source: sendgrid/sendgrid-python

When using a wrong API key:

except Exception as e:
    print(e.message) # AttributeError: 'UnauthorizedError' object has no attribute 'message'

https://github.com/sendgrid/sendgrid-python/blob/master/use_cases/send_a_single_email_to_a_single_recipient.md

medium help wanted help wanted bug up for grabs up-for-grabs

All 11 comments

Thanks for reporting this @OlafvdSpek! I've added this to our backlog for further investigation.

Ah, it looks like it should be:

print(e)
print(e.body)

it should be only
print(e)

Should this issue be closed? It looks like its been resolved, unless I'm mistaken.

Which commit / merge fixed it?

Turns out, I am mistaken :) I'm working on some fixes to the use cases - I found this issue with multiple different .md files, and there were some additional fixes needed to get the script in sending_html.content.md working properly. Still need to finish going through all the other use cases to ensure they run without major issues, though.

Dug through most of the use cases, and they still work apart from 2 -

kitchen_sink.md - two errors thrown, preventing it from sending the hello world email:

  1. categories must be unique
  2. the batch_id not being valid

The former is easily fixed, but I'm having more trouble resolving the latter. Guidance would be appreciated.

aws.md - workflows for AWS have changed significantly since this was written, I think. I had trouble getting code to deploy - I'm not super familiar with AWS, so I wasn't able to resolve the issues. It seemed like the code snippets provided worked, however.

I can add a PR for these changes - Apart from these two issues, I think I've resolved most of the smaller issues in the existing use cases.

Can anyone help me in this errors

2020-01-17T08:59:39.923373+00:00 app[web.1]: 2020-01-17 08:59:39,923 - haruka - INFO - Successfully loaded
2020-01-17T08:59:39.924101+00:00 app[web.1]: 2020-01-17 08:59:39,924 - haruka - INFO - Using long polling.
2020-01-17T08:59:49.368355+00:00 app[web.1]: 2020-01-17 08:59:49,366 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update
2020-01-17T08:59:49.368372+00:00 app[web.1]: Traceback (most recent call last):
2020-01-17T08:59:49.368394+00:00 app[web.1]:   File "/app/haruka/__main__.py", line 627, in process_update
2020-01-17T08:59:49.368397+00:00 app[web.1]:     for handler in (x for x in self.handlers[group] if x.check_update(update)):
2020-01-17T08:59:49.368399+00:00 app[web.1]:   File "/app/haruka/__main__.py", line 627, in <genexpr>
2020-01-17T08:59:49.368401+00:00 app[web.1]:     for handler in (x for x in self.handlers[group] if x.check_update(update)):
2020-01-17T08:59:49.368403+00:00 app[web.1]:   File "/app/haruka/modules/helper_funcs/handlers.py", line 63, in check_update
2020-01-17T08:59:49.368406+00:00 app[web.1]:     res = self.filters(message)
2020-01-17T08:59:49.368408+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/filters.py", line 87, in __call__
2020-01-17T08:59:49.368410+00:00 app[web.1]:     return self.filter(update)
2020-01-17T08:59:49.368412+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/telegram/ext/filters.py", line 1011, in filter
2020-01-17T08:59:49.368414+00:00 app[web.1]:     return update.message is not None or update.edited_message is not None
2020-01-17T08:59:49.368422+00:00 app[web.1]: AttributeError: 'Message' object has no attribute 'message'
2020-01-17T08:59:49.369044+00:00 app[web.1]: 2020-01-17 08:59:49,368 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update
2020-01-17T08:59:49.369047+00:00 app[web.1]: Traceback (most recent call last):
2020-01-17T08:59:49.369049+00:00 app[web.1]:   File "/app/haruka/__main__.py", line 628, in process_update
2020-01-17T08:59:49.369051+00:00 app[web.1]:     handler.handle_update(update, self)
2020-01-17T08:59:49.369057+00:00 app[web.1]: TypeError: handle_update() missing 1 required positional argument: 'check_result'

This issue may have been resolved but the documentation on this page was never updated to reflect the resolution.

Check this link: Integrate using our Web API or SMTP Relay

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thinkingserious picture thinkingserious  路  3Comments

jeffoneill picture jeffoneill  路  4Comments

c-w picture c-w  路  4Comments

iamgollum picture iamgollum  路  4Comments

sohamnavadiya picture sohamnavadiya  路  4Comments