corrected api import workflow
This commit is contained in:
parent
b2c1c6e301
commit
724748d38a
@ -584,7 +584,7 @@ def recipe_from_source(request):
|
|||||||
status=400)
|
status=400)
|
||||||
else:
|
else:
|
||||||
return JsonResponse({"recipe_json": get_from_scraper(scrape, request.space)})
|
return JsonResponse({"recipe_json": get_from_scraper(scrape, request.space)})
|
||||||
else:
|
elif mode == 'url' and auto == 'false':
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=HEADERS)
|
response = requests.get(url, headers=HEADERS)
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
@ -605,7 +605,7 @@ def recipe_from_source(request):
|
|||||||
status=400
|
status=400
|
||||||
)
|
)
|
||||||
data = response.text
|
data = response.text
|
||||||
if (mode == 'source') or (mode == 'url' and auto == 'false'):
|
elif (mode == 'source') or (mode == 'url' and auto == 'false'):
|
||||||
if not data or data == 'undefined':
|
if not data or data == 'undefined':
|
||||||
data = requests.get(url, headers=HEADERS).content
|
data = requests.get(url, headers=HEADERS).content
|
||||||
recipe_json, recipe_tree, recipe_html, images = get_recipe_from_source(data, url, request.space)
|
recipe_json, recipe_tree, recipe_html, images = get_recipe_from_source(data, url, request.space)
|
||||||
@ -625,13 +625,14 @@ def recipe_from_source(request):
|
|||||||
'images': images,
|
'images': images,
|
||||||
})
|
})
|
||||||
|
|
||||||
return JsonResponse(
|
else:
|
||||||
{
|
return JsonResponse(
|
||||||
'error': True,
|
{
|
||||||
'msg': _('I couldn\'t find anything to do.')
|
'error': True,
|
||||||
},
|
'msg': _('I couldn\'t find anything to do.')
|
||||||
status=400
|
},
|
||||||
)
|
status=400
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@group_required('admin')
|
@group_required('admin')
|
||||||
|
Loading…
Reference in New Issue
Block a user