Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix/missing error in response

rafaelsideguide18f69c90b173
diff --git a/apps/python-sdk/firecrawl/firecrawl.py b/apps/python-sdk/firecrawl/firecrawl.py
index 70f677eff..41b5949ad 100644
--- a/apps/python-sdk/firecrawl/firecrawl.py
+++ b/apps/python-sdk/firecrawl/firecrawl.py
@@ -81,8 +81,10 @@ class FirecrawlApp:
response = response.json()
if response['success'] and 'data' in response:
return response['data']
- else:
+ elif "error" in response:
raise Exception(f'Failed to scrape URL. Error: {response["error"]}')
+ else:
+ raise Exception(f'Failed to scrape URL. Error: {response}')
else:
self._handle_error(response, 'scrape URL')
@@ -266,8 +268,10 @@ class FirecrawlApp:
response = response.json()
if response['success'] and 'links' in response:
return response
- else:
+ elif 'error' in response:
raise Exception(f'Failed to map URL. Error: {response["error"]}')
+ else:
+ raise Exception(f'Failed to map URL. Error: {response}')
else:
self._handle_error(response, 'map')