mirror of
https://github.com/nicolargo/glances.git
synced 2026-05-24 06:26:03 -04:00
Error fetching ip with urlopen_auth() - extra function argument #3438
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user