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):
entry = {'id': None, 'name': None, 'aspect': None}
data = urllib.request.urlopen(url).read().decode("utf-8")
ret = json.loads(data)
for row in ret['results']:
for key in entry:
try:
entry[key] = row[key]
except:
entry[key] = None
entry['def'] = row['definition']['text']
if row['id'] == goterm:
for key in entry:
try:
entry[key] = row[key]
except:
entry[key] = None
entry['def'] = row['definition']['text']
return entry
except urllib.error.HTTPError as ex:
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