Added support for logging versions

This commit is contained in:
Sirshendu Ganguly
2026-06-18 13:57:25 +05:30
parent e467ef24fb
commit 5bd857e716
3 changed files with 21 additions and 27 deletions
+3 -11
View File
@@ -7,10 +7,10 @@ import soundfile as sf
import numpy as np
from io import BytesIO
from .utils.runwareUtils import (
RUNWARE_API_KEY,
RUNWARE_API_BASE_URL,
generalRequestWrapper,
genRandUUID,
getRunwareApiHeaders,
sanitize_for_logging,
safe_json_dumps,
sendMediaUUID,
@@ -237,21 +237,13 @@ class RunwareMediaUpload:
"media": mediaData,
}]
def _getApiHeaders(self):
"""Get API request headers"""
return {
"Authorization": f"Bearer {RUNWARE_API_KEY}",
"Content-Type": "application/json",
"Accept-Encoding": "gzip, deflate, br, zstd",
}
def _makeUploadRequest(self, uploadConfig):
"""Make upload request to Runware API"""
def recaller():
print(f"[Debug] Making POST request to Runware API...")
return requests.post(
RUNWARE_API_BASE_URL,
headers=self._getApiHeaders(),
headers=getRunwareApiHeaders(),
json=uploadConfig,
timeout=self.REQUEST_TIMEOUT,
allow_redirects=False,
@@ -301,7 +293,7 @@ class RunwareMediaUpload:
def recaller():
return requests.post(
RUNWARE_API_BASE_URL,
headers=self._getApiHeaders(),
headers=getRunwareApiHeaders(),
json=pollConfig,
timeout=self.REQUEST_TIMEOUT,
allow_redirects=False,
+17 -16
View File
@@ -22,6 +22,20 @@ import re
load_dotenv()
from ...version import __version__
def getRunwareApiHeaders(include_auth=True):
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Accept-Encoding": "gzip, deflate, br, zstd",
"X-SDK-Name": "comfyui",
"X-SDK-Version": __version__,
}
if include_auth:
headers["Authorization"] = f"Bearer {os.getenv('RUNWARE_API_KEY')}"
return headers
BASEFOLDER = Path(__file__).parent.parent.parent
IMAGE_CACHE_FILE = BASEFOLDER / "imagesCache.json"
@@ -250,12 +264,7 @@ def getOrdinal(num):
return ordinals.get(num, f"{num}th")
def checkAPIKey(apiKey):
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Accept-Encoding": "gzip, deflate, br, zstd",
}
headers = getRunwareApiHeaders(include_auth=False)
genConfig = [
{
"taskType": "authentication",
@@ -359,11 +368,7 @@ def inferenecRequest(genConfig):
global RUNWARE_API_KEY, RUNWARE_API_BASE_URL, SESSION_TIMEOUT
RUNWARE_API_KEY = os.getenv("RUNWARE_API_KEY")
SESSION_TIMEOUT = int(os.getenv("RUNWARE_TIMEOUT"))
headers = {
"Authorization": f"Bearer {RUNWARE_API_KEY}",
"Content-Type": "application/json",
"Accept-Encoding": "gzip, deflate, br, zstd",
}
headers = getRunwareApiHeaders()
try:
def recaller():
@@ -720,11 +725,7 @@ def pollVideoResult(taskUUID):
}
]
headers = {
"Authorization": f"Bearer {RUNWARE_API_KEY}",
"Content-Type": "application/json",
"Accept-Encoding": "gzip, deflate, br, zstd",
}
headers = getRunwareApiHeaders()
try:
def recaller():
+1
View File
@@ -0,0 +1 @@
__version__ = "1.8.6"