sendgrid / sendgrid-python

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

406 error #943

Closed mahimaaapatel closed 4 years ago

mahimaaapatel commented 4 years ago

Issue Summary

I'm getting a 406 error when I try to use any method. I didn't have this problem a while ago. I added a contact manually and this error occurs out of nowhere. I checked the available solutions but none are helpful.

Code Snippet

response = sg.client.user.account.get()
print(response.status_code)
print(response.body)
print(response.headers)

Exception/Log

HTTP Error 406: Not Acceptable
mahimaaapatel commented 4 years ago

This keeps happening on and off. It didn't work for a long time and I took a break and it magically worked. I made few more changes and it's not working again even though I'm running the same code again.

eshanholtz commented 4 years ago

Hi @mahimaaapatel

According to the SendGrid response documentation, a 406 error indicates a missing "Accept" header. What's interesting is that you're using the helper library and this is happening on and off. Try logging the full error body by following our troubleshooting guide and posting the output in a follow-up comment.

mahimaaapatel commented 4 years ago

The error hasn't occurred ever since. I don't even know why that happened. I'll raise an issue if it happens again. Thank you.

tayyab-educative commented 3 years ago

I'm also seeing this happen intermittently recently. I'm using version sendgrid==1.5.19 and haven't seen this problem before. No API or system updates on my end. Not using any wrapper etc either that could possibly strip the Accept header. This is the full error message:

<html>
<head><title>406 Not Acceptable</title></head>
<body bgcolor="white">
<center><h1>406 Not Acceptable</h1></center>
<hr><center>nginx</center>
</body>
</html>

Would really appreciate the help.

jacobg commented 3 years ago

Been happening more frequently the past week.