Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
fba14ba5
Commit
fba14ba5
authored
Nov 22, 2022
by
Nejc Habjan
Committed by
Randy Döring
Apr 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: consistently retry on error codes in publish and install
parent
d07dddbc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
3 deletions
+9
-3
src/poetry/publishing/uploader.py
+2
-1
src/poetry/utils/authenticator.py
+2
-1
src/poetry/utils/constants.py
+3
-0
tests/utils/test_authenticator.py
+2
-1
No files found.
src/poetry/publishing/uploader.py
View file @
fba14ba5
...
@@ -21,6 +21,7 @@ from urllib3 import util
...
@@ -21,6 +21,7 @@ from urllib3 import util
from
poetry.__version__
import
__version__
from
poetry.__version__
import
__version__
from
poetry.utils.constants
import
REQUESTS_TIMEOUT
from
poetry.utils.constants
import
REQUESTS_TIMEOUT
from
poetry.utils.constants
import
STATUS_FORCELIST
from
poetry.utils.patterns
import
wheel_file_re
from
poetry.utils.patterns
import
wheel_file_re
...
@@ -68,7 +69,7 @@ class Uploader:
...
@@ -68,7 +69,7 @@ class Uploader:
connect
=
5
,
connect
=
5
,
total
=
10
,
total
=
10
,
allowed_methods
=
[
"GET"
],
allowed_methods
=
[
"GET"
],
status_forcelist
=
[
500
,
501
,
502
,
503
]
,
status_forcelist
=
STATUS_FORCELIST
,
)
)
return
adapters
.
HTTPAdapter
(
max_retries
=
retry
)
return
adapters
.
HTTPAdapter
(
max_retries
=
retry
)
...
...
src/poetry/utils/authenticator.py
View file @
fba14ba5
...
@@ -24,6 +24,7 @@ from filelock import FileLock
...
@@ -24,6 +24,7 @@ from filelock import FileLock
from
poetry.config.config
import
Config
from
poetry.config.config
import
Config
from
poetry.exceptions
import
PoetryException
from
poetry.exceptions
import
PoetryException
from
poetry.utils.constants
import
REQUESTS_TIMEOUT
from
poetry.utils.constants
import
REQUESTS_TIMEOUT
from
poetry.utils.constants
import
STATUS_FORCELIST
from
poetry.utils.password_manager
import
HTTPAuthCredential
from
poetry.utils.password_manager
import
HTTPAuthCredential
from
poetry.utils.password_manager
import
PasswordManager
from
poetry.utils.password_manager
import
PasswordManager
...
@@ -259,7 +260,7 @@ class Authenticator:
...
@@ -259,7 +260,7 @@ class Authenticator:
if
is_last_attempt
:
if
is_last_attempt
:
raise
e
raise
e
else
:
else
:
if
resp
.
status_code
not
in
[
502
,
503
,
504
]
or
is_last_attempt
:
if
resp
.
status_code
not
in
STATUS_FORCELIST
or
is_last_attempt
:
if
raise_for_status
:
if
raise_for_status
:
resp
.
raise_for_status
()
resp
.
raise_for_status
()
return
resp
return
resp
...
...
src/poetry/utils/constants.py
View file @
fba14ba5
...
@@ -3,3 +3,6 @@ from __future__ import annotations
...
@@ -3,3 +3,6 @@ from __future__ import annotations
# Timeout for HTTP requests using the requests library.
# Timeout for HTTP requests using the requests library.
REQUESTS_TIMEOUT
=
15
REQUESTS_TIMEOUT
=
15
# Server response codes to retry requests on.
STATUS_FORCELIST
=
[
500
,
501
,
502
,
503
,
504
]
tests/utils/test_authenticator.py
View file @
fba14ba5
...
@@ -249,7 +249,8 @@ def test_authenticator_request_raises_exception_when_attempts_exhausted(
...
@@ -249,7 +249,8 @@ def test_authenticator_request_raises_exception_when_attempts_exhausted(
(
401
,
0
),
(
401
,
0
),
(
403
,
0
),
(
403
,
0
),
(
404
,
0
),
(
404
,
0
),
(
500
,
0
),
(
500
,
5
),
(
501
,
5
),
(
502
,
5
),
(
502
,
5
),
(
503
,
5
),
(
503
,
5
),
(
504
,
5
),
(
504
,
5
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment