File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -287,8 +287,12 @@ def commonprefix(*m: str) -> str:
287
287
return s1
288
288
289
289
290
+ _netrc_warned = False
291
+
292
+
290
293
def get_netrc_auth (url : str ) -> tuple [str , str ] | None :
291
294
"""Get the auth for the given url from the netrc file."""
295
+ global _netrc_warned
292
296
try :
293
297
from netrc import NetrcParseError , netrc
294
298
except ImportError :
@@ -302,7 +306,11 @@ def get_netrc_auth(url: str) -> tuple[str, str] | None:
302
306
except FileNotFoundError :
303
307
return None
304
308
except (NetrcParseError , OSError ) as e :
305
- logger .warning ("Couldn't parse netrc because of %s: %s" , type (e ).__name__ , e )
309
+ if not _netrc_warned :
310
+ logger .warning (
311
+ "Couldn't parse netrc because of %s: %s" , type (e ).__name__ , e
312
+ )
313
+ _netrc_warned = True
306
314
return None
307
315
info = authenticator .authenticators (hostname )
308
316
You can’t perform that action at this time.
0 commit comments