firecrawl 1.1.1__tar.gz → 1.2.0__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.1.1
3
+ Version: 1.2.0
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
15
15
 
16
- __version__ = "1.1.1"
16
+ __version__ = "1.2.0"
17
17
 
18
18
  # Define the logger for the Firecrawl project
19
19
  logger: logging.Logger = logging.getLogger("firecrawl")
@@ -59,21 +59,31 @@ class FirecrawlApp:
59
59
 
60
60
  # If there are additional params, process them
61
61
  if params:
62
- # Initialize extractorOptions if present
63
- extractor_options = params.get('extractorOptions', {})
64
- # Check and convert the extractionSchema if it's a Pydantic model
65
- if 'extractionSchema' in extractor_options:
66
- if hasattr(extractor_options['extractionSchema'], 'schema'):
67
- extractor_options['extractionSchema'] = extractor_options['extractionSchema'].schema()
68
- # Ensure 'mode' is set, defaulting to 'llm-extraction' if not explicitly provided
69
- extractor_options['mode'] = extractor_options.get('mode', 'llm-extraction')
70
- # Update the scrape_params with the processed extractorOptions
71
- scrape_params['extractorOptions'] = extractor_options
72
-
73
- # Include any other params directly at the top level of scrape_params
74
- for key, value in params.items():
75
- if key != 'extractorOptions':
76
- scrape_params[key] = value
62
+ if self.version == 'v0':
63
+ # Handle extractorOptions (for v0 compatibility)
64
+ extractor_options = params.get('extractorOptions', {})
65
+ if extractor_options:
66
+ if 'extractionSchema' in extractor_options and hasattr(extractor_options['extractionSchema'], 'schema'):
67
+ extractor_options['extractionSchema'] = extractor_options['extractionSchema'].schema()
68
+ extractor_options['mode'] = extractor_options.get('mode', 'llm-extraction')
69
+ scrape_params['extractorOptions'] = extractor_options
70
+
71
+ # Include any other params directly at the top level of scrape_params
72
+ for key, value in params.items():
73
+ if key not in ['extractorOptions']:
74
+ scrape_params[key] = value
75
+ elif self.version == 'v1':
76
+ # Handle extract (for v1)
77
+ extract = params.get('extract', {})
78
+ if extract:
79
+ if 'schema' in extract and hasattr(extract['schema'], 'schema'):
80
+ extract['schema'] = extract['schema'].schema()
81
+ scrape_params['extract'] = extract
82
+
83
+ # Include any other params directly at the top level of scrape_params
84
+ for key, value in params.items():
85
+ if key not in ['extract']:
86
+ scrape_params[key] = value
77
87
 
78
88
  endpoint = f'/v1/scrape'
79
89
  # Make the POST request with the prepared headers and JSON data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: firecrawl
3
- Version: 1.1.1
3
+ Version: 1.2.0
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