Commit e64fb704 authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Address bug where empty(?) response comes back from /find/both endpoint

parent 142695a0
......@@ -6,3 +6,4 @@ venv/
.eggs
VERSION
umich_mcomm.egg-info
livetest.py
from time import sleep
from urllib.parse import quote
......@@ -45,7 +46,19 @@ def get_entity_dn(client, name):
if '=' in name or '@' in name:
return name
data = client.get('/find/both/{}'.format(name)).json()
for i in range(3):
data = client.get('/find/both/{}'.format(name)).json()
if data:
try:
assert type(data[0]) == dict
break
except AssertionError:
sleep(2)
continue
else:
raise MCommError('Searching MCommunity failed.')
else:
raise MCommError('Unable to find specified entity')
if data:
for item in data:
......
Supports Markdown
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