File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,12 @@ def quote_byte(b):
178
178
ResponseType = Tuple [Optional [Reader ], Optional [TextData ], Optional [str ]]
179
179
180
180
181
+ def _rewrite_proxies_to_mounts (proxies ):
182
+ if proxies is None :
183
+ return None
184
+ return {c : httpx .AsyncHTTPTransport (proxy = url ) for c , url in get_proxies ().items ()}
185
+
186
+
181
187
class UrlProxyReader :
182
188
"""
183
189
A collection of functions to handle async downloading of a list of documents
@@ -208,7 +214,8 @@ def read_files(
208
214
209
215
@staticmethod
210
216
async def _read_files (urls : List [str ], callback : Callable ) -> List [ResponseType ]:
211
- async with httpx .AsyncClient (timeout = 10.0 , proxies = get_proxies ()) as client :
217
+ proxy_mounts = _rewrite_proxies_to_mounts (get_proxies ())
218
+ async with httpx .AsyncClient (timeout = 10.0 , mounts = proxy_mounts ) as client :
212
219
req = [UrlProxyReader ._read_file (url , client , callback ) for url in urls ]
213
220
return await asyncio .gather (* req )
214
221
You can’t perform that action at this time.
0 commit comments