0

Merge pull request #176 from mendableai/bug/data-check-in-python-sdk

[Bug] Added data check for python SDK
This commit is contained in:
Nicolas 2024-05-24 09:45:39 -07:00 committed by GitHub
commit e0d979edad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,7 +45,7 @@ class FirecrawlApp:
) )
if response.status_code == 200: if response.status_code == 200:
response = response.json() response = response.json()
if response['success']: if response['success'] and 'data' in response:
return response['data'] return response['data']
else: else:
raise Exception(f'Failed to scrape URL. Error: {response["error"]}') raise Exception(f'Failed to scrape URL. Error: {response["error"]}')
@ -70,7 +70,7 @@ class FirecrawlApp:
) )
if response.status_code == 200: if response.status_code == 200:
response = response.json() response = response.json()
if response['success'] == True: if response['success'] and 'data' in response:
return response['data'] return response['data']
else: else:
raise Exception(f'Failed to search. Error: {response["error"]}') raise Exception(f'Failed to search. Error: {response["error"]}')