feat: 도매상 API 통합 및 스키마 업데이트
- wholesale 패키지 연동 (SooinSession, GeoYoungSession) - Flask Blueprint 분리 (sooin_api.py, geoyoung_api.py) - order_context 스키마 확장 (wholesaler_id, internal_code 등) - 수인약품 개별 취소 기능 (cancel_item, restore_item) - 문서 추가: WHOLESALE_API_INTEGRATION.md - 테스트 스크립트들
This commit is contained in:
39
backend/test_encoding.py
Normal file
39
backend/test_encoding.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import re
|
||||
sys.path.insert(0, r'c:\Users\청춘약국\source\pharmacy-pos-qr-system\backend')
|
||||
from sooin_api import SooinSession
|
||||
|
||||
session = SooinSession()
|
||||
if session.login():
|
||||
# 직접 요청해서 인코딩 확인
|
||||
params = {
|
||||
'so': '0', 'so2': '0', 'so3': '2',
|
||||
'tx_physic': '073100220',
|
||||
'tx_ven': '50911',
|
||||
'currVenNm': '청춘약국'
|
||||
}
|
||||
resp = session.session.get(session.ORDER_URL, params=params, timeout=15)
|
||||
print('Content-Type:', resp.headers.get('Content-Type'))
|
||||
print('Encoding:', resp.encoding)
|
||||
print('Apparent Encoding:', resp.apparent_encoding)
|
||||
|
||||
# charset 확인
|
||||
charset_match = re.search(r'charset=([^\s;"]+)', resp.text[:1000])
|
||||
print('HTML charset:', charset_match.group(1) if charset_match else 'Not found')
|
||||
|
||||
# 직접 디코딩 테스트
|
||||
print('\n--- 디코딩 테스트 ---')
|
||||
test_encodings = ['euc-kr', 'cp949', 'utf-8', 'iso-8859-1']
|
||||
for enc in test_encodings:
|
||||
try:
|
||||
decoded = resp.content.decode(enc, errors='replace')
|
||||
# 코자정이 포함되어 있는지 확인
|
||||
if '코자정' in decoded:
|
||||
print(f'{enc}: 성공! (코자정 발견)')
|
||||
elif '肄' in decoded or 'ㅺ' in decoded:
|
||||
print(f'{enc}: 부분 실패 (깨진 문자 발견)')
|
||||
else:
|
||||
print(f'{enc}: 확인 불가')
|
||||
except Exception as e:
|
||||
print(f'{enc}: 오류 - {e}')
|
||||
Reference in New Issue
Block a user