Skip to content

Commit

Permalink
cyrest/base.py: raise ValueError
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeboucas committed May 26, 2018
1 parent 37e5600 commit 11ad3c4
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions py2cytoscape/cyrest/base.py
Expand Up @@ -123,11 +123,11 @@ def api(namespace=None,command="",PARAMS={},host=HOST,port=str(PORT),version=VER
print("'"+URL+"'")
sys.stdout.flush()
r = requests.get(url = URL)

verbose_=checkresponse(r, verbose=verbose)
if (verbose) or (verbose_):
print("'"+URL+"'")
sys.stdout.flush()

if verbose_:
res=verbose_
else:
Expand All @@ -141,16 +141,12 @@ def api(namespace=None,command="",PARAMS={},host=HOST,port=str(PORT),version=VER
verbose_=checkresponse(r, verbose=verbose)
if (verbose) or (verbose_):
verbose=True
res=r.content
if (verbose) or (verbose_):
print(res)
print(r.content)
sys.stdout.flush()
res=json.loads(res)
#if "errors" in res.keys():
# if len(res["errors"]) > 0:
# verbose=True
# for e in res["errors"]:
# print(e)
res=json.loads(r.content)
if "errors" in res.keys():
if len(res["errors"]) > 0:
raise ValueError(res["errors"][0])
if not verbose:
res=res["data"]
else:
Expand Down

0 comments on commit 11ad3c4

Please sign in to comment.