Sendgrid-python: HTTP requests to SendGrid can hang as `SendGridAPIClient` does not have a timeout.

Created on 15 Feb 2019  路  6Comments  路  Source: sendgrid/sendgrid-python

Issue Summary

HTTP requests to SendGrid could hang, as SendGridAPIClient has no time out defined in case of a network anomaly.

Steps to Reproduce

This is a bit difficult to reproduce, as it could be caused by a network anomaly (Not necessarily SendGrid's issue).

When a network anomaly occurred, it is possible for API calls to SendGrid to hang indefinitely.

  • By default, the HTTP client's timeout defaults to None.
  • When SendGridAPIClient creates a client, it does not allow a timeout to be passed in.
  • User of the client, unfortunately, has no way to provide a timeout, unless s/he creates a wrapper on top of SendGridAPIClient to override SendGridAPIClient.client or to have an outer wrapper to control timeout.

Expected Behavior
Either a reasonable timeout is set, or a timeout option should be allowed when creating a SendGridAPIClient.

Actual
None is available.

Technical details:

  • sendgrid-python Version: master
  • Python Version: 2.7
  • python-http-client Version: master

Relevant Link:

medium good first issue help wanted help wanted community enhancement

Most helpful comment

We've had the same problem recently, for now I've fixed it with:

sendgrid_client = sendgrid.SendGridAPIClient()
sendgrid_client.client.timeout = 10

Hopefully this will be fixed soon, being able to set the timeout when initializing the client would be great.

All 6 comments

Great catch! I've tagged this appropriately and the fix should happen on the v4 branch here..

With Best Regards,

Elmer

It seems it is still not fixed in the last versions, am I right?

It did not @erdnaxeli, but thanks for the comment. Your comment helps us move this up the ladder in our backlog. Thanks!

We've had the same problem recently, for now I've fixed it with:

sendgrid_client = sendgrid.SendGridAPIClient()
sendgrid_client.client.timeout = 10

Hopefully this will be fixed soon, being able to set the timeout when initializing the client would be great.

Since there has been no activity on this issue since March 1, 2020, we are closing this issue. Please feel free to reopen or create a new issue if you still require assistance. Thank you!

I'm also having this issue on python 3.7 and sendgrid==6.6.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielghurley picture danielghurley  路  4Comments

ArchTaqi picture ArchTaqi  路  4Comments

andriisoldatenko picture andriisoldatenko  路  4Comments

thinkingserious picture thinkingserious  路  3Comments

sohamnavadiya picture sohamnavadiya  路  4Comments