@@ -43,16 +43,23 @@ class HTTPFileSystem(FileSystem):
43
43
SESSION_BACKOFF_FACTOR = 0.1
44
44
REQUEST_TIMEOUT = 60
45
45
46
- def __init__ (self , fs = None , timeout = REQUEST_TIMEOUT , ** kwargs ):
46
+ def __init__ (
47
+ self ,
48
+ fs = None ,
49
+ ssl_verify = None ,
50
+ read_timeout = REQUEST_TIMEOUT ,
51
+ connect_timeout = REQUEST_TIMEOUT ,
52
+ ** kwargs ,
53
+ ):
47
54
super ().__init__ (fs , ** kwargs )
48
55
49
56
self .fs_args ["upload_method" ] = kwargs .get ("method" , "POST" )
50
57
client_kwargs = self .fs_args .setdefault ("client_kwargs" , {})
51
58
client_kwargs .update (
52
59
{
53
- "ssl_verify" : kwargs . get ( " ssl_verify" ) ,
54
- "read_timeout" : kwargs . get ( " read_timeout" , timeout ) ,
55
- "connect_timeout" : kwargs . get ( " connect_timeout" , timeout ) ,
60
+ "ssl_verify" : ssl_verify ,
61
+ "read_timeout" : read_timeout ,
62
+ "connect_timeout" : connect_timeout ,
56
63
"trust_env" : True , # Allow reading proxy configs from the env
57
64
}
58
65
)
@@ -92,7 +99,9 @@ def _prepare_credentials(self, **config):
92
99
)
93
100
return {"client_kwargs" : client_kwargs }
94
101
95
- async def get_client (self , ** kwargs ):
102
+ async def get_client (
103
+ self , ssl_verify , read_timeout , connect_timeout , ** kwargs
104
+ ):
96
105
import aiohttp
97
106
from aiohttp_retry import ExponentialRetry
98
107
@@ -110,19 +119,18 @@ async def get_client(self, **kwargs):
110
119
# data blobs. We remove the total timeout, and only limit the time
111
120
# that is spent when connecting to the remote server and waiting
112
121
# for new data portions.
113
- connect_timeout = kwargs .pop ("connect_timeout" )
114
122
kwargs ["timeout" ] = aiohttp .ClientTimeout (
115
123
total = None ,
116
124
connect = connect_timeout ,
117
125
sock_connect = connect_timeout ,
118
- sock_read = kwargs . pop ( " read_timeout" ) ,
126
+ sock_read = read_timeout ,
119
127
)
120
128
121
129
kwargs ["connector" ] = aiohttp .TCPConnector (
122
130
# Force cleanup of closed SSL transports.
123
131
# See https://github.com/iterative/dvc/issues/7414
124
132
enable_cleanup_closed = True ,
125
- ssl = make_context (kwargs . pop ( " ssl_verify" , None ) ),
133
+ ssl = make_context (ssl_verify ),
126
134
)
127
135
128
136
return ReadOnlyRetryClient (** kwargs )
0 commit comments