sendgrid / sendgrid-python

The Official Twilio SendGrid Python API Library
https://sendgrid.com
MIT License
1.53k stars 711 forks source link

python_http_client.exceptions.ForbiddenError: HTTP Error 403: Forbidden #978

Closed ClimenteA closed 3 years ago

ClimenteA commented 3 years ago

I'm not sure why I get a ForbiddenError when I try to send an email.

Here is what I use to test:

import sendgrid
import os, logging
from sendgrid.helpers.mail import Mail

from dotenv import load_dotenv
load_dotenv()

logging.warning('SENDGRID_API_KEY ' + str(os.getenv('SENDGRID_API_KEY')))  # I see the API KEY (the long secret key)

mail_client = sendgrid.SendGridAPIClient(api_key=os.getenv('SENDGRID_API_KEY'))
mail = Mail(
    from_email='Single Sender Verification Email which is verified', 
    subject='test', 
    to_emails=['another email]', 
    html_content='test content'
)

response = mail_client.send(mail)

Here is the error I got:

...python_http_client/client.py", line 184, in _make_request
    raise exc
python_http_client.exceptions.ForbiddenError: HTTP Error 403: Forbidden

My IP appears in IP access management section not sure if it's connected to me trying to send emails.

thinkingserious commented 3 years ago

Hello @ClimenteA,

Thanks for submitting a GitHub issue! We are very sorry that you are running into this problem. In order to better serve you, as this does not present itself as a library specific issue, we would like to ask that you reach out to our support team at https://support.sendgrid.com.

Thank you!

SendGrid DX Team