Commit 8fff593c authored by József Gyürüsi's avatar József Gyürüsi
Browse files

[internal #1848537] Upgrade scripts to use Python3

  missing encode/decode added to DsRestAPI.py

Change-Id: I6c1d12ead91d3c174abad2ab194431a8cef6dcfb
parent c1a7d910
......@@ -32,7 +32,7 @@ class DsRestAPI:
'''
if not isinstance(postdata, str):
postdata = json.dumps(postdata)
req = urllib.request.Request(self.__url, postdata, {'Content-Type': 'application/json'})
req = urllib.request.Request(self.__url, postdata.encode(), {'Content-Type': 'application/json'})
req.add_header('Connection', 'close')
req.get_method = lambda: method
try:
......@@ -166,11 +166,11 @@ def DsRestAPIPythonAPIMain(argv):
f = open(fileName, 'r')
request = json.load(f)
f.close()
print(api.getContentList(request))
print(api.getContentList(request).decode())
elif '-j' in argv:
jsonString = argv[argv.index('-j') + 1]
request = json.loads(jsonString)
print(api.getContentList(request))
print(api.getContentList(request).decode())
else:
requests = []
request = {}
......@@ -222,4 +222,4 @@ if __name__ == "__main__":
errCode = DsRestAPIPythonAPIMain(sys.argv)
except Exception as e:
print('Error while processing your request: ' + str(e))
sys.exit(errCode)
\ No newline at end of file
sys.exit(errCode)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment