mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Add timeout to all Requests calls
Use a default timeout of 30 seconds for all requests, and add a REQUESTS_TIMEOUT Anymail setting to override. (I'm making a judgement call that this is not a breaking change in the real world, and not bumping the major version. Theoretically, it could affect you if your network somehow takes >30s to connect to your ESP, but eventually succeeds. If so, set REQUESTS_TIMEOUT to None to restore the earlier behavior.) Fixes #80.
This commit is contained in:
@@ -269,3 +269,14 @@ This is actually implemented using HTTP basic authorization, and the string is
|
||||
technically a "username:password" format. But you should *not* use any real
|
||||
username or password for this shared secret.
|
||||
|
||||
|
||||
.. setting:: ANYMAIL_REQUESTS_TIMEOUT
|
||||
|
||||
.. rubric:: REQUESTS_TIMEOUT
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
For Requests-based Anymail backends, the timeout value used for all API calls to your ESP.
|
||||
The default is 30 seconds. You can set to a single float, a 2-tuple of floats for
|
||||
separate connection and read timeouts, or `None` to disable timeouts (not recommended).
|
||||
See :ref:`requests:timeouts` in the Requests docs for more information.
|
||||
|
||||
Reference in New Issue
Block a user