Error fetching ip with urlopen_auth() - extra function argument #3438

This commit is contained in:
nicolargo
2026-02-15 14:41:16 +01:00
parent 91d56fb2a5
commit 769c0c183f

View File

@@ -351,13 +351,14 @@ def pretty_date(ref, now=None):
return ''
def urlopen_auth(url, username, password):
def urlopen_auth(url, username, password, timeout=3):
"""Open a url with basic auth"""
return urlopen(
Request(
url,
headers={'Authorization': 'Basic ' + base64.b64encode(f'{username}:{password}'.encode()).decode()},
)
),
timeout=timeout,
)