Mercurial > hg > orthanc
changeset 424:76bc8770741b
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 08 May 2013 11:13:48 +0200 |
parents | 3c4a0e85c1da |
children | 26bb4d05a072 |
files | Resources/Samples/Python/RestToolbox.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)