From 9ab21a9f0b37365424ffcfc16102b793b1d6cc7f Mon Sep 17 00:00:00 2001 From: gardar Date: Sun, 13 Jan 2019 00:59:26 +0000 Subject: [PATCH] Python3 compatibility Changes required for python 3 --- proxmox.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxmox.py b/proxmox.py index d7486f5..08554e1 100755 --- a/proxmox.py +++ b/proxmox.py @@ -25,7 +25,7 @@ # # { "groups": ["utility", "databases"], "a": false, "b": true } -import urllib +import urllib.request, urllib.parse, urllib.error try: import json @@ -131,7 +131,7 @@ class ProxmoxAPI(object): def auth(self): request_path = '{0}api2/json/access/ticket'.format(self.options.url) - request_params = urllib.urlencode({ + request_params = urllib.parse.urlencode({ 'username': self.options.username, 'password': self.options.password, }) @@ -309,7 +309,7 @@ def main(): bool_validate_cert = config_data["validateCert"] except KeyError: pass - if os.environ.has_key('PROXMOX_INVALID_CERT'): + if 'PROXMOX_INVALID_CERT' in os.environ: bool_validate_cert = False parser = OptionParser(usage='%prog [options] --list | --host HOSTNAME') @@ -334,7 +334,7 @@ def main(): if options.pretty: indent = 2 - print(json.dumps(data, indent=indent)) + print((json.dumps(data, indent=indent))) if __name__ == '__main__':