1
0

Upgrade REST to use Python 3

This commit is contained in:
Noah 2016-01-07 13:06:27 -08:00
parent 736e45ce03
commit 546b4cfacb

View File

@ -1,4 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python3
from __future__ import print_function
"""REST: Simple command line interface to testing RESTful services. """REST: Simple command line interface to testing RESTful services.
@ -83,18 +85,18 @@ def do_http(args):
data=args.data, data=args.data,
) )
print args.method, args.url, result.status_code print(args.method, args.url, result.status_code)
# JSON response? # JSON response?
try: try:
parsed = result.json parsed = result.json
print json.dumps(parsed, print(json.dumps(parsed,
sort_keys=True, sort_keys=True,
indent=4, indent=4,
separators=(',', ': '), separators=(',', ': '),
) ))
except: except:
print result.text print(result.text)
def strings_to_dict(strings, separator): def strings_to_dict(strings, separator):