firecrawl 1.6.0__tar.gz → 1.6.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of firecrawl might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: firecrawl
3
- Version: 1.6.0
3
+ Version: 1.6.2
4
4
  Summary: Python SDK for Firecrawl API
5
5
  Home-page: https://github.com/mendableai/firecrawl
6
6
  Author: Mendable.ai
@@ -13,7 +13,7 @@ import os
13
13
 
14
14
  from .firecrawl import FirecrawlApp # noqa
15
15
 
16
- __version__ = "1.6.0"
16
+ __version__ = "1.6.2"
17
17
 
18
18
  # Define the logger for the Firecrawl project
19
19
  logger: logging.Logger = logging.getLogger("firecrawl")
@@ -39,13 +39,6 @@ class FirecrawlApp:
39
39
  data: Optional[Any] = None
40
40
  error: Optional[str] = None
41
41
 
42
- class ErrorResponse(pydantic.BaseModel):
43
- """
44
- Error response.
45
- """
46
- success: bool
47
- error: str
48
-
49
42
  def __init__(self, api_key: Optional[str] = None, api_url: Optional[str] = None) -> None:
50
43
  """
51
44
  Initialize the FirecrawlApp instance with API key, API URL.
@@ -228,12 +221,12 @@ class FirecrawlApp:
228
221
  if status_response.status_code != 200:
229
222
  logger.error(f"Failed to fetch next page: {status_response.status_code}")
230
223
  break
231
- status_data = status_response.json()
232
- data.extend(status_data.get('data', []))
224
+ next_data = status_response.json()
225
+ data.extend(next_data.get('data', []))
226
+ status_data = next_data
233
227
  except Exception as e:
234
228
  logger.error(f"Error during pagination request: {e}")
235
229
  break
236
- status_data.pop('next', None)
237
230
  status_data['data'] = data
238
231
 
239
232
  return {
@@ -437,12 +430,12 @@ class FirecrawlApp:
437
430
  if status_response.status_code != 200:
438
431
  logger.error(f"Failed to fetch next page: {status_response.status_code}")
439
432
  break
440
- status_data = status_response.json()
441
- data.extend(status_data.get('data', []))
433
+ next_data = status_response.json()
434
+ data.extend(next_data.get('data', []))
435
+ status_data = next_data
442
436
  except Exception as e:
443
437
  logger.error(f"Error during pagination request: {e}")
444
438
  break
445
- status_data.pop('next', None)
446
439
  status_data['data'] = data
447
440
 
448
441
  return {
@@ -460,7 +453,7 @@ class FirecrawlApp:
460
453
  self._handle_error(response, 'check batch scrape status')
461
454
 
462
455
 
463
- def extract(self, urls: List[str], params: Optional[ExtractParams] = None) -> Union[ExtractResponse, ErrorResponse]:
456
+ def extract(self, urls: List[str], params: Optional[ExtractParams] = None) -> Any:
464
457
  """
465
458
  Extracts information from a URL using the Firecrawl API.
466
459
 
@@ -493,7 +486,11 @@ class FirecrawlApp:
493
486
  headers
494
487
  )
495
488
  if response.status_code == 200:
496
- return response.json()
489
+ data = response.json()
490
+ if data['success']:
491
+ return data
492
+ else:
493
+ raise Exception(f'Failed to extract. Error: {data["error"]}')
497
494
  else:
498
495
  self._handle_error(response, "extract")
499
496
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: firecrawl
3
- Version: 1.6.0
3
+ Version: 1.6.2
4
4
  Summary: Python SDK for Firecrawl API
5
5
  Home-page: https://github.com/mendableai/firecrawl
6
6
  Author: Mendable.ai
File without changes
File without changes
File without changes
File without changes
File without changes