-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnauthorizedError: HTTP Error 401: Unauthorized error appears when sending e-mail #561
Comments
Now I understand the issue. Example code contains this code |
I have reopened this issue so that we can update the README to make this issue clearer. Thanks @utkusen! |
In addition to making that line clear in the python code, I think the README should also be updated with how to properly set the environment variable for the api key on windows. I found(after multiple attempts) that typing |
Thank you @bchandaka! If you don't mind and have the time, we are accepting PRs :) |
Hello, i have the same issue. I set the environment variable in the command prompt (with and without quote, i was not sure) but the example code gave me 401 error. I have an api key and api key pw, do i need the pw somewhere ? thanks |
My code worked with just the api key and I don't think I even got an api key password. Did you try printing the api key variable in the cli or in your python program to see if the variable is being read/set properly? |
@bchandaka Yes i checked and the class variable self.apikey is well set with my api key |
Hi @thinkingserious, thanks for the link. It says "The provided authorization grant is invalid, expired, or revoked" so i have to regenerate one ? thanks |
Hello @tollvam, Yes, that is what I would try. Thanks! With Best Regards, Elmer |
Just to be sure, do i have to put something in "Query String" on the page to test ? |
Here is an even easier method to test your API Key. |
OMG, I just quickly copy-pasted this example to test if my set-up works, then I spent 40 minutes trying to understand what's wrong with my account .... :( |
therer is answer but i want to add more info. I think that this is because window os. refer this https://github.com/sendgrid/sendgrid-python and |
Hi, I am still facing a 401 error from my python code. I have checked my environment variable is set properly as well. |
@MuhammadSufyanMalik Try logging the error response body to get more details about why it's failing: |
Issue Summary
I can send e-mails with my api key by using curl with following examples: https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/curl_examples.html
But when I try to send an e-mail with "Hello Mail/With Mail Helper Class" code, I get following error:
Technical details:
The text was updated successfully, but these errors were encountered: