Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix(python-sdk): map min_age to minAge in scrape options (#4002)
Saivedant Hava929392070402
diff --git a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_parse_request_preparation.py b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_parse_request_preparation.pyindex a49a0764d..20e1501aa 100644--- a/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_parse_request_preparation.py+++ b/apps/python-sdk/firecrawl/__tests__/unit/v2/methods/test_parse_request_preparation.py@@ -87,3 +87,16 @@ class TestParseRequestPreparation:payload = json.loads(fields["options"])assert "lockdown" not in payload++ def test_prepare_parse_request_strips_min_age(self):+ options = ParseOptions(formats=["markdown"], min_age=1000)+ fields, _ = _prepare_parse_request(+ b"<html><body><h1>Parse</h1></body></html>",+ options,+ filename="upload.html",+ content_type="text/html",+ )++ payload = json.loads(fields["options"])+ assert "minAge" not in payload+ assert "min_age" not in payloaddiff --git a/apps/python-sdk/firecrawl/__tests__/unit/v2/utils/test_validation.py b/apps/python-sdk/firecrawl/__tests__/unit/v2/utils/test_validation.pyindex 387ceb355..2e9ebc1fd 100644--- a/apps/python-sdk/firecrawl/__tests__/unit/v2/utils/test_validation.py+++ b/apps/python-sdk/firecrawl/__tests__/unit/v2/utils/test_validation.py@@ -387,4 +387,14 @@ class TestPrepareScrapeOptions:result = prepare_scrape_options(options)- assert result["parsers"][0]["maxPages"] == 5\ No newline at end of file+ assert result["parsers"][0]["maxPages"] == 5++ def test_prepare_min_age_maps_to_camel_case(self):+ """min_age must be sent as minAge; the server drops the snake_case key."""+ options = ScrapeOptions(min_age=1000, max_age=5000)++ result = prepare_scrape_options(options)++ assert result["minAge"] == 1000+ assert "min_age" not in result+ assert result["maxAge"] == 5000\ No newline at end of filediff --git a/apps/python-sdk/firecrawl/v2/utils/validation.py b/apps/python-sdk/firecrawl/v2/utils/validation.pyindex d4d17ae04..1f16e06a7 100644--- a/apps/python-sdk/firecrawl/v2/utils/validation.py+++ b/apps/python-sdk/firecrawl/v2/utils/validation.py@@ -566,6 +566,7 @@ def prepare_scrape_options(options: Optional[ScrapeOptions]) -> Optional[Dict[st"block_ads": "blockAds","store_in_cache": "storeInCache","max_age": "maxAge",+ "min_age": "minAge","redact_pii": "redactPII","threat_protection": "threatProtection",}