ean vs barcode
This commit is contained in:
1 parent
7fbf415acf
commit
daf6f215fe
3 files changed
+25
-3
No files matched your search
+13
-1
@@ -57,11 +57,23 @@ def on_starting(server):
|
||||
from pathlib import Path
|
||||
|
||||
env_path = Path(__file__).parent.parent / ".env"
|
||||
print(f"[@DEBUG] Looking for .env at: {env_path.absolute()}")
|
||||
if env_path.exists():
|
||||
dotenv.load_dotenv(env_path)
|
||||
print(f"✓ Loaded environment from {env_path}")
|
||||
|
||||
# Verify key was loaded
|
||||
import os
|
||||
|
||||
key = os.getenv("PROD_SQUARE_WEBHOOK_SIGNATURE_KEY") or os.getenv(
|
||||
"SANDBOX_SQUARE_WEBHOOK_SIGNATURE_KEY"
|
||||
)
|
||||
if key:
|
||||
print(f"✓ SQUARE_WEBHOOK_SIGNATURE_KEY loaded: {key[:10]}...")
|
||||
else:
|
||||
print(f"⚠ No .env file found at {env_path}")
|
||||
print(f"⚠ SQUARE_WEBHOOK_SIGNATURE_KEY not found in .env")
|
||||
else:
|
||||
print(f"⚠ No .env file found at {env_path.absolute()}")
|
||||
|
||||
|
||||
def on_reload(server):
|
||||
|
||||
+6
-1
@@ -101,12 +101,17 @@ class AsyncBricksetAPI:
|
||||
)
|
||||
|
||||
set_data = result["sets"][0]
|
||||
|
||||
# Try to get UPC barcode, fall back to EAN if not available
|
||||
barcode_data = set_data.get("barcode", {})
|
||||
upc_code = barcode_data.get("UPC") or barcode_data.get("EAN")
|
||||
|
||||
our_set = {
|
||||
"set_num": set_data["number"],
|
||||
"set_name": set_data["name"],
|
||||
"set_theme": set_data["theme"],
|
||||
"set_image": set_data["image"]["thumbnailURL"],
|
||||
"set_barcode": set_data["barcode"]["UPC"],
|
||||
"set_barcode": upc_code,
|
||||
"set_retailprice": round(
|
||||
set_data["LEGOCom"]["US"]["retailPrice"]
|
||||
),
|
||||
|
||||
+6
-1
@@ -38,12 +38,17 @@ def get_set(set_number: int) -> dict:
|
||||
return False
|
||||
|
||||
print(f"[@DEBUG]\t{data}")
|
||||
|
||||
# Try to get UPC barcode, fall back to EAN if not available
|
||||
barcode_data = data["sets"][0].get("barcode", {})
|
||||
upc_code = barcode_data.get("UPC") or barcode_data.get("EAN")
|
||||
|
||||
our_set = {
|
||||
"set_num": data["sets"][0]["number"],
|
||||
"set_name": data["sets"][0]["name"],
|
||||
"set_theme": data["sets"][0]["theme"],
|
||||
"set_image": data["sets"][0]["image"]["thumbnailURL"],
|
||||
"set_barcode": data["sets"][0]["barcode"]["UPC"],
|
||||
"set_barcode": upc_code,
|
||||
"set_retailprice": round(data["sets"][0]["LEGOCom"]["US"]["retailPrice"]),
|
||||
}
|
||||
# add PW 10% b4 tax
|
||||
|
||||
Reference in new issue
Block a user