diff --git a/plugins/lighttpd/lighttpd_ b/plugins/lighttpd/lighttpd_ index f3066eaf..a120401b 100755 --- a/plugins/lighttpd/lighttpd_ +++ b/plugins/lighttpd/lighttpd_ @@ -1,6 +1,4 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# vim: set fileencoding=utf-8 +#!/usr/bin/env python3 """ =head1 NAME @@ -54,7 +52,7 @@ SPDX-License-Identifier: GPL-3.0-only import os import sys -import urllib2 +import urllib.request program = sys.argv[0] @@ -114,17 +112,17 @@ elif len(sys.argv) == 2 and sys.argv[1] == "suggest": else: status_url = os.environ.get('status_url', 'http://127.0.0.1/server-status') - request = urllib2.Request("%s?auto" % status_url) + request = urllib.request.Request("%s?auto" % status_url) if "username" in os.environ and "password" in os.environ: - mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() + mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm() mgr.add_password(None, status_url, os.environ["username"], os.environ["password"]) if os.environ.get("auth_type", "basic") == "digest": - auth = urllib2.HTTPDigestAuthHandler(mgr) + auth = urllib.request.HTTPDigestAuthHandler(mgr) else: - auth = urllib2.HTTPBasicAuthHandler(mgr) - opener = urllib2.build_opener(auth) - urllib2.install_opener(opener) - info = urllib2.urlopen(request).read() + auth = urllib.request.HTTPBasicAuthHandler(mgr) + opener = urllib.request.build_opener(auth) + urllib.request.install_opener(opener) + info = urllib.request.urlopen(request).read() data = {} for line in info.split("\n"): try: