Skip to content

Commit e92955e

Browse files
committed
chore(pre-commit): introduce settings for timeouts for requests
1 parent 5bf69dd commit e92955e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

benefits/settings.py

+6
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,9 @@ def _filter_empty(ls):
309309
]
310310
env_style_src = _filter_empty(os.environ.get("DJANGO_CSP_STYLE_SRC", "").split(","))
311311
CSP_STYLE_SRC.extend(env_style_src)
312+
313+
# Configuration for requests
314+
# https://requests.readthedocs.io/en/latest/user/advanced/#timeouts
315+
316+
REQUESTS_CONNECT_TIMEOUT = os.environ.get("REQUESTS_CONNECT_TIMEOUT", 3)
317+
REQUESTS_READ_TIMEOUT = os.environ.get("REQUESTS_READ_TIMEOUT", 1)

docs/configuration/environment-variables.md

+14
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,20 @@ Comma-separated list of hosts which are trusted origins for unsafe requests (e.g
153153

154154
Comma-separated list of User-Agent strings which, when present as an HTTP header, should only receive healthcheck responses. Used by our `HealthcheckUserAgents` middleware.
155155

156+
## `requests` configuration
157+
158+
!!! tldr "`requests` docs"
159+
160+
[Docs for timeouts](https://requests.readthedocs.io/en/latest/user/advanced/#timeouts)
161+
162+
### `REQUESTS_CONNECT_TIMEOUT`
163+
164+
The number of seconds `requests` will wait for the client to establish a connection to a remote machine. Defaults to 3 seconds.
165+
166+
### `REQUESTS_READ_TIMEOUT`
167+
168+
The number of seconds the client will wait for the server to send a response. Defaults to 1 second.
169+
156170
## Cypress tests
157171

158172
!!! tldr "Cypress docs"

0 commit comments

Comments
 (0)