# HG changeset patch # User Sebastien Jodogne # Date 1368004428 -7200 # Node ID 76bc8770741ba42fec80feda12aad89f13a9a441 # Parent 3c4a0e85c1da9bc1d9eab5a38b15b84c7c45cc23 fix diff -r 3c4a0e85c1da -r 76bc8770741b Resources/Samples/Python/RestToolbox.py --- a/Resources/Samples/Python/RestToolbox.py Tue May 07 14:36:35 2013 +0200 +++ b/Resources/Samples/Python/RestToolbox.py Wed May 08 11:13:48 2013 +0200 @@ -13,7 +13,7 @@ if _credentials != None: h.add_credentials(_credentials[0], _credentials[1]) -def DoGet(uri, data = {}): +def DoGet(uri, data = {}, interpretAsJson = True): d = '' if len(data.keys()) > 0: d = '?' + urlencode(data) @@ -23,6 +23,8 @@ resp, content = h.request(uri + d, 'GET') if not (resp.status in [ 200 ]): raise Exception(resp.status) + elif not interpretAsJson: + return content else: try: return json.loads(content)