- response = session.get(
- 'https://publisher.woblink.com/author/autocomplete/' + term
- ).json()
- return JsonResponse({
- "results": [
- {
- "id": item['autId'],
- "text": item['autFullname'],
- }
- for item in response
- ],
- })
+
+ if category == 'author':
+ results = woblink.search_author_catalogue(term)
+ elif category == 'series':
+ results = woblink.search_series_catalogue(term)
+ else:
+ raise Http404
+
+ return JsonResponse({"results": results})