Upgrade REST to use Python 3
This commit is contained in:
parent
736e45ce03
commit
546b4cfacb
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user