# -*- coding: utf-8 -*-
"""HTML 전체 분석"""
from sooin_api import SooinSession

session = SooinSession()
session.login()

resp = session.session.get('http://sooinpharm.co.kr/Service/Order/Bag.asp?currVenCd=50911')

# 전체 저장해서 분석
with open('bag_page.html', 'w', encoding='utf-8') as f:
    f.write(resp.text)
    
print('bag_page.html 저장됨')
print(f'길이: {len(resp.text)}')

# 현재 장바구니 상태
cart = session.get_cart()
print(f'장바구니: {cart.get("total_items", 0)}개')
for item in cart.get('items', []):
    print(f'  - {item.get("product_name")}')
