feat: implement backend API clients for multi-marketplace integration and frontend service layer

This commit is contained in:
2026-05-12 13:16:14 +03:00
parent 6974af486a
commit ee39a3d83b
65 changed files with 2501 additions and 33 deletions

View File

@@ -0,0 +1,44 @@
import os
import sys
from dotenv import load_dotenv
# Add parent dir to path so we can import backend packages
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from backend.flowwow_api import FlowwowAPI
from backend.flowwow_api.exceptions import FlowwowAPIError
def test_flowwow_api():
# Load environment variables
env_path = os.path.join(os.path.dirname(__file__), '.env')
load_dotenv(env_path)
# Check if key is loaded
api_token = os.getenv('FLOWWOW_API_TOKEN')
if not api_token:
print("Error: FLOWWOW_API_TOKEN must be in backend/.env")
return
print("Initializing FlowwowAPI...")
api = FlowwowAPI()
try:
# Test 1: Get Products
print("\n--- Testing Products API ---")
products_response = api.products.get_list(limit=5)
print("Success! Response keys:", products_response.keys())
items = products_response.get("items", [])
if not items:
items = products_response.get("data", [])
print(f"Found {len(items)} products in Flowwow catalog.")
except FlowwowAPIError as e:
print(f"API Error: {e}")
except Exception as e:
print(f"Unexpected Error: {e}")
if __name__ == '__main__':
test_flowwow_api()