sendgrid / sendgrid-python

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

Access forbidden when I tried to add recipients to a list #860

Closed mohamedelephant closed 4 years ago

mohamedelephant commented 4 years ago

Issue Summary

I tried to add users to a list I have that I created manually on the dashboard. It always shows me access forbidden.

Steps to Reproduce

  1. I accessed sendgrid v3 API documentation and put my API Key.
  2. I edited the data to what I want to add to the list.
  3. when I run the command, it gives me access forbidden.
  4. I gave the API key full permission, then I tried again, the same thing.

this is the piece of code I have. `

import http.client
def lambda_handler(event, context):
    conn = http.client.HTTPSConnection("api.sendgrid.com")

    payload = "    [{\"email\":\"example@example.com\",\"first_name\":\"\",\"last_name\":\"User\",\"age\":25},{\"email\":\"example2@example.com\",\"first_name\":\"Example\",\"last_name\":\"User\",\"age\":25}]"

    headers = {'Authorization': 'Bearer ACCESS_TOKEN, 'Accept': 'application/json'}

    conn.request("POST", "/v3/contactdb/recipients", payload, headers)

    res = conn.getresponse()
    data = res.read()

    print(data.decode("utf-8"))

if __name__ == "__main__":
    print(lambda_handler('s','s'))

`

What to do? is it paid feature? I can't get it working. Thanks.

thinkingserious commented 4 years ago

Hello @mohamedelephant,

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