misc fixes

This commit is contained in:
C committed 2025-10-11 13:56:34 -07:00
1 parent 67891e5222
commit 2308d183e9
2 files changed
+16 -4

No files matched your search

+2 -1
View File
@@ -53,7 +53,7 @@ class AsyncBricksetAPI:
self.logger.info("Successfully authenticated with Brickset API") self.logger.info("Successfully authenticated with Brickset API")
return result return result
async def get_set(self, set_number: str) -> Dict[str, Any]: async def get_set(self, set_number: int) -> Dict[str, Any]:
""" """
Fetch LEGO set information asynchronously Fetch LEGO set information asynchronously
@@ -72,6 +72,7 @@ class AsyncBricksetAPI:
"userHash": self.user_hash, "userHash": self.user_hash,
"params": json.dumps({"setNumber": f"{set_number}-1"}), "params": json.dumps({"setNumber": f"{set_number}-1"}),
} }
print(f"[@DEBUG] {params}...")
async with aiohttp.ClientSession() as session: async with aiohttp.ClientSession() as session:
async with session.get( async with session.get(
+14 -3
View File
@@ -11,8 +11,8 @@ import re
import logging import logging
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler
from pathlib import Path from pathlib import Path
print("Creating log directory if it doesn't exist...") #print("Creating log directory if it doesn't exist...")
Path("./logs/").mkdir(parents=True, exist_ok=True) #Path("./logs/").mkdir(parents=True, exist_ok=True)
import banner import banner
import get_sq_env import get_sq_env
@@ -47,7 +47,18 @@ UA = re.compile(r"^kopling\/?", re.IGNORECASE)
async def run_update(): async def run_update():
set_list = await sq.acat2id(SQUARE_LEGO_CAT_ID) set_list = await sq.acat2id(SQUARE_LEGO_CAT_ID)
print(f"[@DEBUG]\t {set_list}") # type: ignore #print(f"[@DEBUG]\t {set_list}") # type: ignore
for l_set in set_list:
#print(f"[@DEBUG]{l_set}")
try:
l_setinfo = await lego.throttled_get_set(l_set["number"])
print(f"[@DEBUG] Found {l_setinfo["pw_name"]}")
except Exception as e:
print(f"Error fetching set\t: {l_set}: {str(e)}")
continue
#print(f"[@DEBUG]{l_setinfo}")
#await sq.update_itm(l_set, l_setinfo)
"""for l_set in set_list: """for l_set in set_list:
print(f"[@DEBUG]{l_set}") print(f"[@DEBUG]{l_set}")
try: try: