Commit 8430dbc0 authored by Gabriel Foley's avatar Gabriel Foley

getGODef in webservice now only returns a single GO term

parent 8fa94535
...@@ -185,13 +185,15 @@ def getGODef(goterm): ...@@ -185,13 +185,15 @@ def getGODef(goterm):
entry = {'id': None, 'name': None, 'aspect': None} entry = {'id': None, 'name': None, 'aspect': None}
data = urllib.request.urlopen(url).read().decode("utf-8") data = urllib.request.urlopen(url).read().decode("utf-8")
ret = json.loads(data) ret = json.loads(data)
for row in ret['results']: for row in ret['results']:
for key in entry: if row['id'] == goterm:
try: for key in entry:
entry[key] = row[key] try:
except: entry[key] = row[key]
entry[key] = None except:
entry['def'] = row['definition']['text'] entry[key] = None
entry['def'] = row['definition']['text']
return entry return entry
except urllib.error.HTTPError as ex: except urllib.error.HTTPError as ex:
raise RuntimeError(ex.read()) raise RuntimeError(ex.read())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment