Port to Python3, canonicalize JSON, retain Umlauts
This commit is contained in:
parent
fe0e30f173
commit
ed139e5b59
|
@ -1,10 +1,17 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from inema import ProductInformation
|
from inema import ProductInformation
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info.major >= 3:
|
||||||
|
unicode = str
|
||||||
|
|
||||||
# you have to fill the below with your login details for the ProdWS Service
|
# you have to fill the below with your login details for the ProdWS Service
|
||||||
USER = "xxx"
|
USER = "xxx"
|
||||||
PASS = "yyyyyy"
|
PASS = "yyyyyy"
|
||||||
|
@ -33,7 +40,9 @@ if data['success']:
|
||||||
'max_weight': unicode(weight['maxValue'])
|
'max_weight': unicode(weight['maxValue'])
|
||||||
}
|
}
|
||||||
|
|
||||||
print json.dumps(products)
|
json.dump(products, sys.stdout,
|
||||||
|
sort_keys=True, indent=4, ensure_ascii=False)
|
||||||
|
print('')
|
||||||
else:
|
else:
|
||||||
print 'ERROR: %s' % data['Exception']
|
print('ERROR: %s' % data['Exception'], file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue