From 0ea82c5d5b3f5347f9961a10708d9ebb4dcaf5b7 Mon Sep 17 00:00:00 2001 From: Bartosz Sokorski Date: Sun, 14 May 2023 20:58:32 +0200 Subject: [PATCH] Add experimental POETRY_REQUESTS_TIMEOUT option (#7081) Co-authored-by: Bjorn Neergaard --- docs/faq.md | 7 +++++++ src/poetry/utils/constants.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index 71ac22c1c2d..00aae56a7b1 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -223,3 +223,10 @@ RUN poetry install --no-dev The two key options we are using here are `--no-root` (skips installing the project source) and `--no-directory` (skips installing any local directory path dependencies, you can omit this if you don't have any). [More information on the options available for `poetry install`]({{< relref "cli#install" >}}). + + +### My requests are timing out! + +Poetry's default HTTP request timeout is 15 seconds, the same as `pip`. +Similar to `PIP_REQUESTS_TIMEOUT`, the **experimental** environment variable `POETRY_REQUESTS_TIMEOUT` +can be set to alter this value. diff --git a/src/poetry/utils/constants.py b/src/poetry/utils/constants.py index 56bec540ae2..e8fe2918e50 100644 --- a/src/poetry/utils/constants.py +++ b/src/poetry/utils/constants.py @@ -1,8 +1,10 @@ from __future__ import annotations +import os + # Timeout for HTTP requests using the requests library. -REQUESTS_TIMEOUT = 15 +REQUESTS_TIMEOUT = int(os.getenv("POETRY_REQUESTS_TIMEOUT", 15)) RETRY_AFTER_HEADER = "retry-after"