From 99dcc36e6ed9ec2a527481a442419780d90ab24c Mon Sep 17 00:00:00 2001 From: rafaelmmiller <150964962+rafaelsideguide@users.noreply.github.com> Date: Mon, 18 Aug 2025 16:14:20 -0300 Subject: [PATCH] (sdks): fixed origin, batch aio and tests --- apps/js-sdk/firecrawl/src/__tests__/e2e/v2/crawl.test.ts | 2 +- apps/js-sdk/firecrawl/src/v2/utils/httpClient.ts | 2 -- apps/python-sdk/firecrawl/v2/methods/aio/batch.py | 4 +--- apps/python-sdk/firecrawl/v2/utils/http_client.py | 4 ---- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/apps/js-sdk/firecrawl/src/__tests__/e2e/v2/crawl.test.ts b/apps/js-sdk/firecrawl/src/__tests__/e2e/v2/crawl.test.ts index 0ba2a485f..2f2283ea1 100644 --- a/apps/js-sdk/firecrawl/src/__tests__/e2e/v2/crawl.test.ts +++ b/apps/js-sdk/firecrawl/src/__tests__/e2e/v2/crawl.test.ts @@ -95,7 +95,7 @@ describe("v2.crawl e2e", () => { test("get active crawls with running crawl", async () => { if (!client) throw new Error(); const start = await client.startCrawl("https://docs.firecrawl.dev", { limit: 5 }); - await new Promise(resolve => setTimeout(resolve, 1000)); + await new Promise(resolve => setTimeout(resolve, 300)); const active = await client.getActiveCrawls(); expect(Array.isArray(active.crawls)).toBe(true); const ids = active.crawls.map(c => c.id); diff --git a/apps/js-sdk/firecrawl/src/v2/utils/httpClient.ts b/apps/js-sdk/firecrawl/src/v2/utils/httpClient.ts index 96914517c..d0715a601 100644 --- a/apps/js-sdk/firecrawl/src/v2/utils/httpClient.ts +++ b/apps/js-sdk/firecrawl/src/v2/utils/httpClient.ts @@ -44,8 +44,6 @@ export class HttpClient { const version = getVersion(); config.headers = { ...(config.headers || {}), - // origin header for GET/DELETE; for POST we also include in body below - origin: `js-sdk@${version}`, }; let lastError: any; diff --git a/apps/python-sdk/firecrawl/v2/methods/aio/batch.py b/apps/python-sdk/firecrawl/v2/methods/aio/batch.py index 55642c0c6..4bc92f80c 100644 --- a/apps/python-sdk/firecrawl/v2/methods/aio/batch.py +++ b/apps/python-sdk/firecrawl/v2/methods/aio/batch.py @@ -71,9 +71,7 @@ async def cancel_batch_scrape(client: AsyncHttpClient, job_id: str) -> bool: if response.status_code >= 400: handle_response_error(response, "cancel batch scrape") body = response.json() - if not body.get("success"): - raise Exception(body.get("error", "Unknown error occurred")) - return True + return body.get("status") == "cancelled" async def get_batch_scrape_errors(client: AsyncHttpClient, job_id: str) -> Dict[str, Any]: diff --git a/apps/python-sdk/firecrawl/v2/utils/http_client.py b/apps/python-sdk/firecrawl/v2/utils/http_client.py index 787192c29..c6a33f6de 100644 --- a/apps/python-sdk/firecrawl/v2/utils/http_client.py +++ b/apps/python-sdk/firecrawl/v2/utils/http_client.py @@ -84,8 +84,6 @@ class HttpClient: if headers is None: headers = self._prepare_headers() - headers['origin'] = f'python-sdk@{version}' - url = f"{self.api_url}{endpoint}" last_exception = None @@ -125,8 +123,6 @@ class HttpClient: """Make a DELETE request with retry logic.""" if headers is None: headers = self._prepare_headers() - - headers['origin'] = f'python-sdk@{version}' url = f"{self.api_url}{endpoint}"