mirror of
https://github.com/drewkerrigan/nagios-http-json.git
synced 2024-11-22 10:23:50 +01:00
parent
83ee5062f5
commit
dd952fd571
@ -585,8 +585,8 @@ if __name__ == "__main__":
|
|||||||
req = urllib.request.Request(url)
|
req = urllib.request.Request(url)
|
||||||
req.add_header("User-Agent", "check_http_json")
|
req.add_header("User-Agent", "check_http_json")
|
||||||
if args.auth:
|
if args.auth:
|
||||||
# TODO: replace deprecated encodestring
|
authbytes = str(args.auth).encode()
|
||||||
base64str = base64.encodestring(args.auth).replace('\n', '')
|
base64str = base64.encodebytes(authbytes).decode().replace('\n', '')
|
||||||
req.add_header('Authorization', 'Basic %s' % base64str)
|
req.add_header('Authorization', 'Basic %s' % base64str)
|
||||||
if args.headers:
|
if args.headers:
|
||||||
headers = json.loads(args.headers)
|
headers = json.loads(args.headers)
|
||||||
|
Loading…
Reference in New Issue
Block a user