Skip to content

Commit

Permalink
feat(fal_client): add support for webhook in submit() (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop authored Oct 17, 2024
1 parent 604c373 commit e9b21f0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions projects/fal_client/src/fal_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ async def submit(
*,
path: str = "",
hint: str | None = None,
webhook_url: str | None = None,
) -> AsyncRequestHandle:
"""Submit an application with the given arguments (which will be JSON serialized). The path parameter can be used to
specify a subpath when applicable. This method will return a handle to the request that can be used to check the status
Expand All @@ -325,6 +326,9 @@ async def submit(
if path:
url += "/" + path.lstrip("/")

if webhook_url is not None:
url += f"?fal_webhook={webhook_url}"

headers = {}
if hint is not None:
headers["X-Fal-Runner-Hint"] = hint
Expand Down Expand Up @@ -496,6 +500,7 @@ def submit(
*,
path: str = "",
hint: str | None = None,
webhook_url: str | None = None,
) -> SyncRequestHandle:
"""Submit an application with the given arguments (which will be JSON serialized). The path parameter can be used to
specify a subpath when applicable. This method will return a handle to the request that can be used to check the status
Expand All @@ -505,6 +510,9 @@ def submit(
if path:
url += "/" + path.lstrip("/")

if webhook_url is not None:
url += f"?fal_webhook={webhook_url}"

headers = {}
if hint is not None:
headers["X-Fal-Runner-Hint"] = hint
Expand Down

0 comments on commit e9b21f0

Please sign in to comment.