Python3 compatibility

Changes required for python 3
This commit is contained in:
gardar 2019-01-13 00:59:26 +00:00 committed by GitHub
parent 43fa3d8c14
commit 9ab21a9f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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__':