feat(python-sdk): configurable origin attribution for Arcade and other integrators - #4440
feat(python-sdk): configurable origin attribution for Arcade and other integrators#4440erikengervall wants to merge 1 commit into
Conversation
Integrators like Arcade can stamp origin=arcade-mcp instead of the hardcoded python-sdk@version. Also expose wait_crawl on AsyncFirecrawl and fix async agent status checks for httpx (status_code vs resp.ok). Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
2 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/python-sdk/firecrawl/client.py">
<violation number="1" location="apps/python-sdk/firecrawl/client.py:296">
P1: The sync `Firecrawl` client references `self._v2_client.wait_crawl`, but `FirecrawlClient` (v2/client.py) defines no `wait_crawl` method. Because this assignment runs in `__init__` and evaluates the attribute immediately, constructing the sync client raises `AttributeError`. The async v2 client has a `wait_crawl` method, so the async addition is fine; the sync side needs either a `wait_crawl` method added to `FirecrawlClient` or to keep using the existing `crawl`/`start_crawl` waiter.</violation>
<violation number="2" location="apps/python-sdk/firecrawl/client.py:296">
P0: Constructing the sync `Firecrawl` client now raises `AttributeError`: `self.wait_crawl = self._v2_client.wait_crawl` reads an attribute that the sync v2 `FirecrawlClient` (v2/client.py) does not define. `wait_crawl` exists only on the async v2 client (v2/client_async.py). Either add a `wait_crawl` method to the sync v2 client, or gate this assignment so sync construction does not crash.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
|
||
| self.crawl = self._v2_client.crawl | ||
| self.start_crawl = self._v2_client.start_crawl | ||
| self.wait_crawl = self._v2_client.wait_crawl |
There was a problem hiding this comment.
P0: Constructing the sync Firecrawl client now raises AttributeError: self.wait_crawl = self._v2_client.wait_crawl reads an attribute that the sync v2 FirecrawlClient (v2/client.py) does not define. wait_crawl exists only on the async v2 client (v2/client_async.py). Either add a wait_crawl method to the sync v2 client, or gate this assignment so sync construction does not crash.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/python-sdk/firecrawl/client.py, line 296:
<comment>Constructing the sync `Firecrawl` client now raises `AttributeError`: `self.wait_crawl = self._v2_client.wait_crawl` reads an attribute that the sync v2 `FirecrawlClient` (v2/client.py) does not define. `wait_crawl` exists only on the async v2 client (v2/client_async.py). Either add a `wait_crawl` method to the sync v2 client, or gate this assignment so sync construction does not crash.</comment>
<file context>
@@ -289,6 +293,7 @@ def __init__(
self.crawl = self._v2_client.crawl
self.start_crawl = self._v2_client.start_crawl
+ self.wait_crawl = self._v2_client.wait_crawl
self.crawl_params_preview = self._v2_client.crawl_params_preview
self.get_crawl_status = self._v2_client.get_crawl_status
</file context>
|
|
||
| self.crawl = self._v2_client.crawl | ||
| self.start_crawl = self._v2_client.start_crawl | ||
| self.wait_crawl = self._v2_client.wait_crawl |
There was a problem hiding this comment.
P1: The sync Firecrawl client references self._v2_client.wait_crawl, but FirecrawlClient (v2/client.py) defines no wait_crawl method. Because this assignment runs in __init__ and evaluates the attribute immediately, constructing the sync client raises AttributeError. The async v2 client has a wait_crawl method, so the async addition is fine; the sync side needs either a wait_crawl method added to FirecrawlClient or to keep using the existing crawl/start_crawl waiter.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/python-sdk/firecrawl/client.py, line 296:
<comment>The sync `Firecrawl` client references `self._v2_client.wait_crawl`, but `FirecrawlClient` (v2/client.py) defines no `wait_crawl` method. Because this assignment runs in `__init__` and evaluates the attribute immediately, constructing the sync client raises `AttributeError`. The async v2 client has a `wait_crawl` method, so the async addition is fine; the sync side needs either a `wait_crawl` method added to `FirecrawlClient` or to keep using the existing `crawl`/`start_crawl` waiter.</comment>
<file context>
@@ -289,6 +293,7 @@ def __init__(
self.crawl = self._v2_client.crawl
self.start_crawl = self._v2_client.start_crawl
+ self.wait_crawl = self._v2_client.wait_crawl
self.crawl_params_preview = self._v2_client.crawl_params_preview
self.get_crawl_status = self._v2_client.get_crawl_status
</file context>
Summary
origin=onFirecrawl/AsyncFirecrawland v2 HTTP clients so integrators can stamp attribution (e.g.arcade-mcp) instead of the hardcodedpython-sdk@versionclient.originwait_crawlon the top-level async client (parity with sync)status_code >= 400instead ofresp.ok(httpx has no.ok)Test plan
pytest apps/python-sdk/firecrawl/__tests__/unit/v2/utils/test_origin.pyoriginwhen constructed withorigin="arcade-mcp"originquery param from the clientMade with Cursor
Summary by cubic
Adds configurable request origin attribution to the Python SDK so integrators like Arcade can stamp their own identifier (e.g.
arcade-mcp) instead of the hardcodedpython-sdk@<version>. Defaults topython-sdk@<version>when noorigin=is provided, so existing callers are unaffected.New Features
origin=argument toFirecrawl,AsyncFirecrawl, and the v2 HTTP clients.wait_crawlonAsyncFirecrawl, matching the sync client.Bug Fixes
status_code >= 400since httpx responses have no.okattribute.Written for commit e570554. Summary will update on new commits.