fix(sdks): fetch next/pagination
This commit is contained in:
@@ -13,7 +13,7 @@ import os
|
|||||||
|
|
||||||
from .firecrawl import FirecrawlApp
|
from .firecrawl import FirecrawlApp
|
||||||
|
|
||||||
__version__ = "1.2.1"
|
__version__ = "1.2.2"
|
||||||
|
|
||||||
# Define the logger for the Firecrawl project
|
# Define the logger for the Firecrawl project
|
||||||
logger: logging.Logger = logging.getLogger("firecrawl")
|
logger: logging.Logger = logging.getLogger("firecrawl")
|
||||||
|
|||||||
@@ -346,6 +346,12 @@ class FirecrawlApp:
|
|||||||
status_data = status_response.json()
|
status_data = status_response.json()
|
||||||
if status_data['status'] == 'completed':
|
if status_data['status'] == 'completed':
|
||||||
if 'data' in status_data:
|
if 'data' in status_data:
|
||||||
|
data = status_data['data']
|
||||||
|
while 'next' in status_data:
|
||||||
|
status_response = self._get_request(status_data['next'], headers)
|
||||||
|
status_data = status_response.json()
|
||||||
|
data.extend(status_data['data'])
|
||||||
|
status_data['data'] = data
|
||||||
return status_data
|
return status_data
|
||||||
else:
|
else:
|
||||||
raise Exception('Crawl job completed but no data was returned')
|
raise Exception('Crawl job completed but no data was returned')
|
||||||
|
|||||||
Reference in New Issue
Block a user