From 9bf1fc71d766c2abba525cd477e69c146f68bf78 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Tue, 22 Apr 2025 19:31:09 -0700 Subject: [PATCH] Change to api.comfy.org --- .github/workflows/update-api-stubs.yml | 2 +- comfy_api_nodes/apis/client.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-api-stubs.yml b/.github/workflows/update-api-stubs.yml index b27f2c580..2ae99b673 100644 --- a/.github/workflows/update-api-stubs.yml +++ b/.github/workflows/update-api-stubs.yml @@ -25,7 +25,7 @@ jobs: - name: Generate API models run: | - datamodel-codegen --use-subclass-enum --url https://stagingapi.comfy.org/openapi --output comfy_api_nodes/apis --output-model-type pydantic_v2.BaseModel + datamodel-codegen --use-subclass-enum --url https://api.comfy.org/openapi --output comfy_api_nodes/apis --output-model-type pydantic_v2.BaseModel - name: Check for changes id: git-check diff --git a/comfy_api_nodes/apis/client.py b/comfy_api_nodes/apis/client.py index 606bce569..c10ff7017 100644 --- a/comfy_api_nodes/apis/client.py +++ b/comfy_api_nodes/apis/client.py @@ -147,7 +147,7 @@ class ApiClient: logging.debug(f"[DEBUG] Files: {files}") logging.debug(f"[DEBUG] Params: {params}") logging.debug(f"[DEBUG] Json: {json}") - + try: # If files are present, use data parameter instead of json if files: @@ -212,6 +212,8 @@ class ApiClient: error_message = "Unauthorized: Please login first to use this node." if status_code == 402: error_message = "Payment Required: Please add credits to your account to use this node." + if status_code == 429: + error_message = "Rate Limit Exceeded: Please try again later." raise Exception(error_message) # Parse and return JSON response @@ -263,7 +265,7 @@ class SynchronousOperation(Generic[T, R]): endpoint: ApiEndpoint[T, R], request: T, files: Optional[Dict[str, Any]] = None, - api_base: str = "https://stagingapi.comfy.org", + api_base: str = "https://api.comfy.org", auth_token: Optional[str] = None, timeout: float = 60.0, verify_ssl: bool = True,