Skip to content

Commit ab98941

Browse files
committed
fix error mapping
1 parent e47a2ff commit ab98941

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

curl_adapter/base_adapter.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,12 @@
88
import typing
99
import warnings
1010

11-
from urllib3.exceptions import (
12-
IncompleteRead
13-
)
1411
from urllib3.util import parse_url
1512
from urllib3.response import HTTPResponse
1613
from urllib3._collections import HTTPHeaderDict
1714

1815
import requests
19-
from requests.exceptions import (
20-
RequestException,
21-
ConnectionError,
22-
ConnectTimeout,
23-
InvalidHeader,
24-
InvalidProxyURL,
25-
InvalidSchema,
26-
InvalidURL,
27-
ProxyError,
28-
ReadTimeout,
29-
RetryError,
30-
SSLError,
31-
HTTPError,
32-
TooManyRedirects,
33-
ContentDecodingError
34-
)
16+
3517

3618
from requests.utils import (
3719
DEFAULT_CA_BUNDLE_PATH,
@@ -48,7 +30,23 @@
4830
from requests.cookies import extract_cookies_to_jar
4931
from requests.adapters import BaseAdapter
5032
from requests.models import Response
51-
33+
from requests.exceptions import (
34+
RequestException,
35+
ConnectionError,
36+
ConnectTimeout,
37+
InvalidHeader,
38+
InvalidProxyURL,
39+
InvalidSchema,
40+
InvalidURL,
41+
ProxyError,
42+
ReadTimeout,
43+
RetryError,
44+
SSLError,
45+
HTTPError,
46+
TooManyRedirects,
47+
ContentDecodingError,
48+
ChunkedEncodingError
49+
)
5250
import pycurl
5351
import curl_cffi.curl
5452
from curl_cffi.curl import CurlInfo as CurlInfoOpt, CurlOpt, CurlError
@@ -199,7 +197,7 @@ def cert_verify(self, curl, url: str, verify: bool, cert):
199197
CurlECode.PROXY: ProxyError,
200198
CurlECode.SSL_CLIENTCERT: SSLError,
201199
CurlECode.ECH_REQUIRED: SSLError,
202-
CurlECode.PARTIAL_FILE: IncompleteRead,
200+
CurlECode.PARTIAL_FILE: ChunkedEncodingError,
203201
}
204202

205203
def curl_error_map(self, error: typing.Union[CurlError, pycurl.error]):

0 commit comments

Comments
 (0)