import subprocess, json, urllib.request # 1. Fetch menu data from KFC API headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'} req = urllib.request.Request('https://api.kfcvietnam.com.vn/menu/kfcvn-generic-menu', headers=headers) with urllib.request.urlopen(req) as resp: data = json.loads(resp.read().decode('utf-8')) subcats = data['categories'][0]['categories'] # Base standalone prices mapping for combo component breakdown base_prices = { '1 Miếng Gà Rán': 37000, '1 Miếng Phi-lê Gà Quay': 43000, 'Burger Gà Yo': 30000, 'Burger Tôm': 45000, 'Burger Gà Zinger': 56000, 'Burger Phi-lê Gà Quay': 56000, 'Mì Ý Xúc Xích Gà': 38000, 'Mì Ý Gà Viên': 43000, 'Mì Ý Gà Rán': 68000, '1 Cơm Gà Rán': 49000, '1 Cơm Gà Viên Nanban': 40000, '1 Cơm Phi-lê Gà Quay': 54000, 'Khoai Tây Chiên (Vừa)': 20000, 'Khoai Tây Chiên (Lớn)': 30000, 'Khoai Tây Chiên (Đại)': 40000, 'Khoai Tây Nghiền (Vừa)': 13000, 'Khoai Tây Nghiền (Lớn)': 23000, 'Khoai Tây Nghiền (Đại)': 32000, '1 Bắp Cải Trộn (Vừa)': 13000, '1 Bắp Cải Trộn (Lớn)': 23000, '1 Bắp Cải Trộn (Đại)': 32000, '1 Bánh Trứng': 20000, 'Gà Viên Popcorn (Vừa)': 40000, 'Gà Viên Popcorn (Lớn)': 67000, '3 Miếng Gà Rán Tender': 42000, 'Pepsi (Tiêu Chuẩn)': 13000, 'Pepsi (Vừa)': 17000, 'Pepsi (Đại)': 20000, } # 2. Create Spreadsheet cmd_create = [ 'python3', '/root/.hermes/profiles/reviewer/skills/productivity/google-workspace/scripts/google_api.py', 'sheets', 'create', '--title', 'KFC_Vietnam_Menu_Optimization_Analysis', '--sheet-name', 'ThucDon_KFC_Va_GiaTri' ] res = subprocess.run(cmd_create, capture_output=True, text=True, env={'HERMES_HOME': '/root/.hermes'}) print("Create output:", res.stdout) create_res = json.loads(res.stdout) spreadsheet_id = create_res['spreadsheetId'] spreadsheet_url = create_res['spreadsheetUrl'] print(f"Spreadsheet ID: {spreadsheet_id}") print(f"Spreadsheet URL: {spreadsheet_url}") # 3. Share with nhivo2504@gmail.com cmd_share = [ 'python3', '/root/.hermes/profiles/reviewer/skills/productivity/google-workspace/scripts/google_api.py', 'drive', 'share', spreadsheet_id, '--type', 'user', '--email', 'nhivo2504@gmail.com', '--role', 'writer' ] res_share = subprocess.run(cmd_share, capture_output=True, text=True, env={'HERMES_HOME': '/root/.hermes'}) print("Share output:", res_share.stdout) # Also share as anyone reader cmd_share_anyone = [ 'python3', '/root/.hermes/profiles/reviewer/skills/productivity/google-workspace/scripts/google_api.py', 'drive', 'share', spreadsheet_id, '--type', 'anyone', '--role', 'reader' ] subprocess.run(cmd_share_anyone, capture_output=True, text=True, env={'HERMES_HOME': '/root/.hermes'})