50def response(resp):
51 results = []
52
53 search_res = loads(resp.text)
54
55
56 if search_res.get('total', 0) < 1:
57 return []
58
59
60 for result in search_res['results']:
61 if 'id' not in result:
62 continue
63
64
65 thumbnail = None
66 if 'logo' in result:
67 thumbnail = result['logo']
68 if thumbnail[0] == '/':
69 thumbnail = url + thumbnail
70
71 content = None
72 if 'highlights' in result:
73 content = result['highlights'][0]['value']
74
75
76 results.append(
77 {
78 'url': url + 'structure/' + result['id'],
79 'title': result['label'],
80 'thumbnail': thumbnail,
81 'content': html_to_text(content),
82 }
83 )
84
85
86 return results