parent
221cf53390
commit
72e042ec03
|
|
@ -19,6 +19,13 @@ a = Analysis(
|
||||||
(os.path.join(spec_dir, 'models'), 'models'),
|
(os.path.join(spec_dir, 'models'), 'models'),
|
||||||
(os.path.join(spec_dir, 'Lib', 'site-packages', 'paddle', 'libs', '*.dll'), 'paddle\\libs'),
|
(os.path.join(spec_dir, 'Lib', 'site-packages', 'paddle', 'libs', '*.dll'), 'paddle\\libs'),
|
||||||
(os.path.join(spec_dir, 'config.ini'), '.')
|
(os.path.join(spec_dir, 'config.ini'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-Bold.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSans.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-ExtraBold.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-Regular.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-SemiBold.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'simfang.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'Percenty_SS_Code.json'), '.')
|
||||||
],
|
],
|
||||||
hiddenimports=[
|
hiddenimports=[
|
||||||
'shapely', 'pyclipper', 'imghdr', 'skimage', 'skimage.morphology._skeletonize', 'imgaug', 'scipy.io', 'lmdb', 'tqdm', 'paddlepaddle.core'
|
'shapely', 'pyclipper', 'imghdr', 'skimage', 'skimage.morphology._skeletonize', 'imgaug', 'scipy.io', 'lmdb', 'tqdm', 'paddlepaddle.core'
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ class ImageDescriptionGenerator:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logger.debug(f"오류 발생: {e}")
|
logger.debug(f"오류 발생: {e}", exc_info=True)
|
||||||
return "오류 발생: 유효한 응답을 생성할 수 없습니다."
|
return "오류 발생: 유효한 응답을 생성할 수 없습니다."
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"예상치 못한 오류 발생: {e}")
|
logger.debug(f"예상치 못한 오류 발생: {e}", exc_info=True)
|
||||||
return "예상치 못한 오류 발생: 처리할 수 없습니다."
|
return "예상치 못한 오류 발생: 처리할 수 없습니다."
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@ def main(image_url='https://file.percenty.co.kr/public/652bed8e865b1f32ea62bf1f/
|
||||||
'''
|
'''
|
||||||
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(f"오류 발생: {e}")
|
print(f"오류 발생: {e}", exc_info=True)
|
||||||
return "오류 발생: 유효한 응답을 생성할 수 없습니다."
|
return "오류 발생: 유효한 응답을 생성할 수 없습니다."
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"예상치 못한 오류 발생: {e}")
|
print(f"예상치 못한 오류 발생: {e}", exc_info=True)
|
||||||
return "예상치 못한 오류 발생: 처리할 수 없습니다."
|
return "예상치 못한 오류 발생: 처리할 수 없습니다."
|
||||||
|
|
||||||
def _process_description(description):
|
def _process_description(description):
|
||||||
|
|
|
||||||
|
|
@ -205,5 +205,5 @@ class AutoPercentyProductsDB:
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# 예외 발생 시 로그 기록
|
# 예외 발생 시 로그 기록
|
||||||
logging.error(f"Error loading product info for product ID {product_id}: {e}")
|
logging.error(f"Error loading product info for product ID {product_id}: {e}", exc_info=True)
|
||||||
return None
|
return None
|
||||||
|
|
@ -44,7 +44,7 @@ def click_element(driver, element_type, element_identifier, wait_time=10, click_
|
||||||
except TimeoutException:
|
except TimeoutException:
|
||||||
logger.error(f"'{element_identifier}' 요소를 {wait_time} 초 이내에 찾지 못함.")
|
logger.error(f"'{element_identifier}' 요소를 {wait_time} 초 이내에 찾지 못함.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"예상치 못한 오류 발생: {e}")
|
logger.error(f"예상치 못한 오류 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
def return_element(driver, element_type, element_identifier, wait_time=10):
|
def return_element(driver, element_type, element_identifier, wait_time=10):
|
||||||
"""
|
"""
|
||||||
|
|
@ -75,18 +75,18 @@ def return_element(driver, element_type, element_identifier, wait_time=10):
|
||||||
return element_visible
|
return element_visible
|
||||||
|
|
||||||
except TimeoutException as e:
|
except TimeoutException as e:
|
||||||
logger.debug(f"'{element_identifier}' 요소를 {wait_time} 초 이내에 찾지 못함. 예외: {e}")
|
logger.debug(f"'{element_identifier}' 요소를 {wait_time} 초 이내에 찾지 못함. 예외: {e}", exc_info=True)
|
||||||
# 시각적으로 보이지 않는 경우, DOM 내 존재 여부만 확인
|
# 시각적으로 보이지 않는 경우, DOM 내 존재 여부만 확인
|
||||||
try:
|
try:
|
||||||
element_in_dom = driver.find_element(getattr(By, element_type), element_identifier)
|
element_in_dom = driver.find_element(getattr(By, element_type), element_identifier)
|
||||||
logger.debug(f"'{element_identifier}' 요소는 DOM 내에 존재하지만 보이지 않음.")
|
logger.debug(f"'{element_identifier}' 요소는 DOM 내에 존재하지만 보이지 않음.")
|
||||||
return element_in_dom
|
return element_in_dom
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"DOM 내에서도 '{element_identifier}' 요소를 찾을 수 없음. 예외: {e}")
|
logger.debug(f"DOM 내에서도 '{element_identifier}' 요소를 찾을 수 없음. 예외: {e}", exc_info=True)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"예상치 못한 오류 발생: {e}")
|
logger.debug(f"예상치 못한 오류 발생: {e}", exc_info=True)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ def wait_element(driver, element_type, element_identifier, wait_time=10):
|
||||||
logger.error(f"에러 : '{element_identifier}' 요소를 {wait_time} 초 이내에 찾지 못함.")
|
logger.error(f"에러 : '{element_identifier}' 요소를 {wait_time} 초 이내에 찾지 못함.")
|
||||||
return False
|
return False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"예상치 못한 오류 발생: {e}")
|
logger.error(f"예상치 못한 오류 발생: {e}", exc_info=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def click_and_confirm_tab(driver, data_node_key, timeout=10):
|
def click_and_confirm_tab(driver, data_node_key, timeout=10):
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ def safe_generate_content(gemini, product_info, max_retries=3, initial_wait=1):
|
||||||
# wait_time *= 2 # Exponential backoff
|
# wait_time *= 2 # Exponential backoff
|
||||||
# retry_count += 1
|
# retry_count += 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"예외 발생 : {e}")
|
logger.debug(f"예외 발생 : {e}", exc_info=True)
|
||||||
logger.debug(f"예외 발생으로 재시도 : {retry_count + 1}/{max_retries}")
|
logger.debug(f"예외 발생으로 재시도 : {retry_count + 1}/{max_retries}")
|
||||||
time.sleep(wait_time)
|
time.sleep(wait_time)
|
||||||
wait_time *= 2 # Exponential backoff
|
wait_time *= 2 # Exponential backoff
|
||||||
|
|
@ -366,7 +366,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
logger.debug(f"검색된 스스 캣코드 : {naver_code}")
|
logger.debug(f"검색된 스스 캣코드 : {naver_code}")
|
||||||
product_info.naver_code = naver_code
|
product_info.naver_code = naver_code
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"카테고리 코드 검색 중 예외 발생 : {e}")
|
logger.debug(f"카테고리 코드 검색 중 예외 발생 : {e}", exc_info=True)
|
||||||
naver_code = ""
|
naver_code = ""
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -389,7 +389,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
# logger.debug(f"수집된 정보 \n {product_info_card} \n")
|
# logger.debug(f"수집된 정보 \n {product_info_card} \n")
|
||||||
logger.debug("네이버쇼핑 파싱 완료")
|
logger.debug("네이버쇼핑 파싱 완료")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"네이버쇼핑 파싱 중 에러발생 : {e}")
|
logger.debug(f"네이버쇼핑 파싱 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -412,7 +412,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
EC.presence_of_element_located((By.XPATH, "//button[contains(.,'저장하기')]"))
|
EC.presence_of_element_located((By.XPATH, "//button[contains(.,'저장하기')]"))
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상세페이지 탭으로 이동 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"상세페이지 탭으로 이동 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# detail_tab = driver.find_element(By.CSS_SELECTOR, ".ant-tabs-tab:nth-child(6)")
|
# detail_tab = driver.find_element(By.CSS_SELECTOR, ".ant-tabs-tab:nth-child(6)")
|
||||||
# detail_tab.click()
|
# detail_tab.click()
|
||||||
time.sleep(0.2) # 페이지 로딩 대기
|
time.sleep(0.2) # 페이지 로딩 대기
|
||||||
|
|
@ -423,7 +423,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
EC.presence_of_element_located((By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div"))
|
EC.presence_of_element_located((By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div"))
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상세페이지 xpath 요소 가져오기 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"상세페이지 xpath 요소 가져오기 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# detail_content = driver.find_element(By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div")
|
# detail_content = driver.find_element(By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div")
|
||||||
# detail_content = driver.find_element(By.ID, "rc-tabs-0-tab-5")
|
# detail_content = driver.find_element(By.ID, "rc-tabs-0-tab-5")
|
||||||
|
|
||||||
|
|
@ -451,7 +451,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
product_info.packing_fee = packing_fee
|
product_info.packing_fee = packing_fee
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상세페이지 편집 중 에러발생 : {e}")
|
logger.debug(f"상세페이지 편집 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -489,7 +489,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
# detail_content.send_keys(cost_add_text)
|
# detail_content.send_keys(cost_add_text)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"가격정보 생성 중 에러 : {e}")
|
logger.debug(f"가격정보 생성 중 에러 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -506,7 +506,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
# logger.debug("HTML 수정 버튼을 성공적으로 찾았습니다.")
|
# logger.debug("HTML 수정 버튼을 성공적으로 찾았습니다.")
|
||||||
# html_btn.click()
|
# html_btn.click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"HTML 수정 버튼 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"HTML 수정 버튼 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# html_btn = driver.find_element(By.CSS_SELECTOR, ".ck-source-editing-button")
|
# html_btn = driver.find_element(By.CSS_SELECTOR, ".ck-source-editing-button")
|
||||||
|
|
@ -529,7 +529,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
|
|
||||||
# textarea.click()
|
# textarea.click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"textarea버튼 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"textarea버튼 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# # data-value 속성 값을 가져옵니다.
|
# # data-value 속성 값을 가져옵니다.
|
||||||
|
|
@ -573,7 +573,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
logger.debug("새로운 값이 성공적으로 설정됨.")
|
logger.debug("새로운 값이 성공적으로 설정됨.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"새로운 값 설정 중 오류 발생: {e}")
|
logger.error(f"새로운 값 설정 중 오류 발생: {e}", exc_info=True)
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
|
||||||
# textarea.send_keys(Keys.ENTER)
|
# textarea.send_keys(Keys.ENTER)
|
||||||
|
|
@ -590,7 +590,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
logger.debug("HTML 수정 버튼 다시 클릭하여 기본편집페이지로 돌아감.")
|
logger.debug("HTML 수정 버튼 다시 클릭하여 기본편집페이지로 돌아감.")
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"HTML 전환 수정 중 에러발생 : {e}")
|
logger.debug(f"HTML 전환 수정 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 상세페이지 내용에 텍스트 추가
|
# 상세페이지 내용에 텍스트 추가
|
||||||
|
|
@ -620,7 +620,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
detail_content.send_keys(Keys.ENTER)
|
detail_content.send_keys(Keys.ENTER)
|
||||||
detail_content.send_keys(Keys.ENTER)
|
detail_content.send_keys(Keys.ENTER)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"AI 컨텐츠 입력 중 에러발생 : {e}")
|
logger.error(f"AI 컨텐츠 입력 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# logger.debug("상세페이지 이미지 번역 시작")
|
# logger.debug("상세페이지 이미지 번역 시작")
|
||||||
|
|
@ -640,7 +640,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
|
|
||||||
# logger.debug("이미지 번역 완료")
|
# logger.debug("이미지 번역 완료")
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.error(f"이미지 번역 중 에러발생 : {e}")
|
# logger.error(f"이미지 번역 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# logger.debug("====번역이미지 붙여넣기 완료=====")
|
# logger.debug("====번역이미지 붙여넣기 완료=====")
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
logger.debug(f"검색된 스스 캣코드 : {naver_code}")
|
logger.debug(f"검색된 스스 캣코드 : {naver_code}")
|
||||||
product_info.naver_code = naver_code
|
product_info.naver_code = naver_code
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"카테고리 코드 검색 중 예외 발생 : {e}")
|
logger.debug(f"카테고리 코드 검색 중 예외 발생 : {e}", exc_info=True)
|
||||||
naver_code = ""
|
naver_code = ""
|
||||||
|
|
||||||
# click_element('XPATH', '/html/body/div[7]/div/div[3]/div/div[2]/div[1]/div/div[2]/div[8]/div/div/div[2]/div[1]/div/div/span[2]/div/div')
|
# click_element('XPATH', '/html/body/div[7]/div/div[3]/div/div[2]/div[1]/div/div[2]/div[8]/div/div/div[2]/div[1]/div/div/span[2]/div/div')
|
||||||
|
|
@ -428,7 +428,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
EC.presence_of_element_located((By.XPATH, "//button[contains(.,'저장하기')]"))
|
EC.presence_of_element_located((By.XPATH, "//button[contains(.,'저장하기')]"))
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상세페이지 탭으로 이동 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"상세페이지 탭으로 이동 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# detail_tab = driver.find_element(By.CSS_SELECTOR, ".ant-tabs-tab:nth-child(6)")
|
# detail_tab = driver.find_element(By.CSS_SELECTOR, ".ant-tabs-tab:nth-child(6)")
|
||||||
detail_tab.click()
|
detail_tab.click()
|
||||||
time.sleep(2) # 페이지 로딩 대기
|
time.sleep(2) # 페이지 로딩 대기
|
||||||
|
|
@ -439,7 +439,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
EC.presence_of_element_located((By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div"))
|
EC.presence_of_element_located((By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div"))
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상세페이지 xpath 요소 가져오기 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"상세페이지 xpath 요소 가져오기 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# detail_content = driver.find_element(By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div")
|
# detail_content = driver.find_element(By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[2]/div[2]/div[2]/div")
|
||||||
# detail_content = driver.find_element(By.ID, "rc-tabs-0-tab-5")
|
# detail_content = driver.find_element(By.ID, "rc-tabs-0-tab-5")
|
||||||
|
|
||||||
|
|
@ -484,7 +484,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
# logger.debug(f"수집된 정보 \n {product_info_text} \n")
|
# logger.debug(f"수집된 정보 \n {product_info_text} \n")
|
||||||
logger.debug("네이버쇼핑 파싱 완료")
|
logger.debug("네이버쇼핑 파싱 완료")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상세페이지 편집 중 에러발생 : {e}")
|
logger.debug(f"상세페이지 편집 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
html_btn_by_contains_xpath="//button[contains(.,'소스')]"
|
html_btn_by_contains_xpath="//button[contains(.,'소스')]"
|
||||||
|
|
@ -500,7 +500,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
# html_btn.click()
|
# html_btn.click()
|
||||||
logger.debug("HTML 수정 버튼 클릭 .")
|
logger.debug("HTML 수정 버튼 클릭 .")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"HTML 수정 버튼 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"HTML 수정 버튼 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# html_btn = driver.find_element(By.CSS_SELECTOR, ".ck-source-editing-button")
|
# html_btn = driver.find_element(By.CSS_SELECTOR, ".ck-source-editing-button")
|
||||||
|
|
@ -514,7 +514,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
textarea.click()
|
textarea.click()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"textarea버튼 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"textarea버튼 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# # data-value 속성 값을 가져옵니다.
|
# # data-value 속성 값을 가져옵니다.
|
||||||
|
|
@ -569,7 +569,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
logger.debug("HTML 수정 버튼 다시 클릭하여 기본편집페이지로 돌아감.")
|
logger.debug("HTML 수정 버튼 다시 클릭하여 기본편집페이지로 돌아감.")
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"HTML 전환 수정 중 에러발생 : {e}")
|
logger.debug(f"HTML 전환 수정 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# 상세페이지 내용에 텍스트 추가
|
# 상세페이지 내용에 텍스트 추가
|
||||||
|
|
@ -599,7 +599,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
detail_content.send_keys(Keys.ENTER)
|
detail_content.send_keys(Keys.ENTER)
|
||||||
detail_content.send_keys(Keys.ENTER)
|
detail_content.send_keys(Keys.ENTER)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"AI 컨텐츠 입력 중 에러발생 : {e}")
|
logger.error(f"AI 컨텐츠 입력 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
logger.debug("상세페이지 이미지 번역 시작")
|
logger.debug("상세페이지 이미지 번역 시작")
|
||||||
|
|
@ -619,7 +619,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
|
|
||||||
logger.debug("이미지 번역 완료")
|
logger.debug("이미지 번역 완료")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"이미지 번역 중 에러발생 : {e}")
|
logger.error(f"이미지 번역 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
logger.debug("====번역이미지 붙여넣기 완료=====")
|
logger.debug("====번역이미지 붙여넣기 완료=====")
|
||||||
|
|
@ -677,7 +677,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
detail_content.send_keys(add_text)
|
detail_content.send_keys(add_text)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"가격정보 생성 중 에러 : {e}")
|
logger.debug(f"가격정보 생성 중 에러 : {e}", exc_info=True)
|
||||||
|
|
||||||
# 저장 버튼 클릭
|
# 저장 버튼 클릭
|
||||||
# try:
|
# try:
|
||||||
|
|
@ -686,7 +686,7 @@ def modify_detail_page(driver, product_info, gemini, delv_collection, json_naver
|
||||||
# )
|
# )
|
||||||
# logger.debug("저장 버튼을 성공적으로 찾았습니다.")
|
# logger.debug("저장 버튼을 성공적으로 찾았습니다.")
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"저장 버튼 요소를 찾을 수 없습니다. : {e}")
|
# logger.debug(f"저장 버튼 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# save_button = driver.find_element(By.XPATH, "//button[contains(.,'저장하기')]")
|
# save_button = driver.find_element(By.XPATH, "//button[contains(.,'저장하기')]")
|
||||||
# save_button.click()
|
# save_button.click()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ def load_naver_codes(filename="Percenty_SS_code.json"):
|
||||||
item = json.loads(line)
|
item = json.loads(line)
|
||||||
codes.append(item)
|
codes.append(item)
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
logger.error(f"Error decoding JSON: {e}")
|
logger.error(f"Error decoding JSON: {e}", exc_info=True)
|
||||||
return codes
|
return codes
|
||||||
|
|
||||||
# 한 번만 호출하여 메모리에 로드
|
# 한 번만 호출하여 메모리에 로드
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ def find_naver_code_ori(base_category):
|
||||||
print(f"찾은 카테고리 코드 : {item['Naver_code']}")
|
print(f"찾은 카테고리 코드 : {item['Naver_code']}")
|
||||||
return item['Naver_code'] # 조건에 맞는 첫 번째 코드를 반환하고 함수 종료
|
return item['Naver_code'] # 조건에 맞는 첫 번째 코드를 반환하고 함수 종료
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
logger.debug(f"Error decoding JSON: {e}")
|
logger.debug(f"Error decoding JSON: {e}", exc_info=True)
|
||||||
continue
|
continue
|
||||||
return None # 조건에 맞는 코드를 찾지 못한 경우
|
return None # 조건에 맞는 코드를 찾지 못한 경우
|
||||||
|
|
||||||
|
|
@ -55,8 +55,8 @@ def find_naver_code(base_category, json_naver_codes):
|
||||||
logger.debug(f"찾은 카테고리 코드 : {item['Naver_code']}")
|
logger.debug(f"찾은 카테고리 코드 : {item['Naver_code']}")
|
||||||
return item['Naver_code'] # 조건에 맞는 첫 번째 코드를 반환하고 함수 종료
|
return item['Naver_code'] # 조건에 맞는 첫 번째 코드를 반환하고 함수 종료
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error processing item: {e}")
|
logger.error(f"Error processing item: {e}", exc_info=True)
|
||||||
continue
|
continue
|
||||||
return None # 조건에 맞는 코드를 찾지 못한 경우
|
return None # 조건에 맞는 코드를 찾지 못한 경우
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"find_naver_code 함수 실행 중 에러 발생 : {e}")
|
logger.error(f"find_naver_code 함수 실행 중 에러 발생 : {e}", exc_info=True)
|
||||||
|
|
@ -79,7 +79,7 @@ def modify_option_page(driver, product_info):
|
||||||
logger.debug(f"옵션타입 {idx} 요소를 찾을 수 없음.")
|
logger.debug(f"옵션타입 {idx} 요소를 찾을 수 없음.")
|
||||||
options_info[f'option_type_{idx}']['options_count'] = None
|
options_info[f'option_type_{idx}']['options_count'] = None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"옵션 타입 {idx} 갯수를 가져오는 중 오류 발생: {e}")
|
logger.error(f"옵션 타입 {idx} 갯수를 가져오는 중 오류 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
# # 가격 낮은 순으로 정렬
|
# # 가격 낮은 순으로 정렬
|
||||||
# logger.debug("가격 낮은 순으로 정렬")
|
# logger.debug("가격 낮은 순으로 정렬")
|
||||||
|
|
@ -103,7 +103,7 @@ def modify_option_page(driver, product_info):
|
||||||
# # 해당 XPath를 이용하여 웹 요소 찾기
|
# # 해당 XPath를 이용하여 웹 요소 찾기
|
||||||
# opt_img_element = driver.find_element(By.XPATH, opt_img_xpath)
|
# opt_img_element = driver.find_element(By.XPATH, opt_img_xpath)
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"옵션 이미지 xpath를 찾을 수 없음 {e}")
|
# logger.debug(f"옵션 이미지 xpath를 찾을 수 없음 {e}", exc_info=True)
|
||||||
# opt_img_element = None
|
# opt_img_element = None
|
||||||
# # 옵션이미지가 없을 경우 처리
|
# # 옵션이미지가 없을 경우 처리
|
||||||
# if not opt_img_element:
|
# if not opt_img_element:
|
||||||
|
|
@ -157,7 +157,7 @@ def modify_option_page(driver, product_info):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.error(f"옵션타입 {option_idx}에 대한 정보가 없습니다.")
|
logger.error(f"옵션타입 {option_idx}에 대한 정보가 없습니다.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"옵션타입 {option_idx} 처리 중 오류 발생: {e}")
|
logger.error(f"옵션타입 {option_idx} 처리 중 오류 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
logger.debug("옵션선택과 옵션명 수정 완료 후 옵션명 정리")
|
logger.debug("옵션선택과 옵션명 수정 완료 후 옵션명 정리")
|
||||||
|
|
@ -219,7 +219,7 @@ def edit_option(driver, option_type, option_count):
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"옵션 타입 {option_type} 편집 중 예외 발생: {e}")
|
logger.error(f"옵션 타입 {option_type} 편집 중 예외 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
def option_name_trans(driver, product_info, option_type_number, option_count, allowed_special_chars, special_char_replacements):
|
def option_name_trans(driver, product_info, option_type_number, option_count, allowed_special_chars, special_char_replacements):
|
||||||
|
|
||||||
|
|
@ -253,7 +253,7 @@ def option_name_trans(driver, product_info, option_type_number, option_count, al
|
||||||
|
|
||||||
ori_optionNames.append(ori_optionName)
|
ori_optionNames.append(ori_optionName)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"원본옵션명 처리중 에러발생 : {e}")
|
logger.debug(f"원본옵션명 처리중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# 원본 옵션명을 하나의 텍스트로 합치기
|
# 원본 옵션명을 하나의 텍스트로 합치기
|
||||||
|
|
@ -279,7 +279,7 @@ def option_name_trans(driver, product_info, option_type_number, option_count, al
|
||||||
try:
|
try:
|
||||||
product_info.update_option_names(option_type_number, ori_optionNames, trans_optionNames)
|
product_info.update_option_names(option_type_number, ori_optionNames, trans_optionNames)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"product_info 옵션명 업데이트 중 에러 발생 {e}")
|
logger.debug(f"product_info 옵션명 업데이트 중 에러 발생 {e}", exc_info=True)
|
||||||
|
|
||||||
# 번역된 옵션명을 각 input 요소에 입력
|
# 번역된 옵션명을 각 input 요소에 입력
|
||||||
try:
|
try:
|
||||||
|
|
@ -298,7 +298,7 @@ def option_name_trans(driver, product_info, option_type_number, option_count, al
|
||||||
optionName_input_element.send_keys(trans_optionName) # 번역된 옵션명 입력
|
optionName_input_element.send_keys(trans_optionName) # 번역된 옵션명 입력
|
||||||
logger.debug(f"{i}번째 옵션명에 '{trans_optionName}' 입력")
|
logger.debug(f"{i}번째 옵션명에 '{trans_optionName}' 입력")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"번역 옵션명 처리중 에러발생 : {e}")
|
logger.debug(f"번역 옵션명 처리중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# 특수문자를 대체하거나 제거하는 함수를 정의합니다.
|
# 특수문자를 대체하거나 제거하는 함수를 정의합니다.
|
||||||
|
|
@ -352,7 +352,7 @@ def update_price_range(driver, options_info, product_info):
|
||||||
price_range = [int(price.strip()) for price in price_parts]
|
price_range = [int(price.strip()) for price in price_parts]
|
||||||
all_price_ranges.extend(price_range)
|
all_price_ranges.extend(price_range)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"옵션 타입 {option_type_key}의 {i}번 가격 범위를 가져오는데 실패했습니다. 에러: {e}")
|
logger.error(f"옵션 타입 {option_type_key}의 {i}번 가격 범위를 가져오는데 실패했습니다. 에러: {e}", exc_info=True)
|
||||||
|
|
||||||
# 모든 옵션의 가격 범위에서 전체 최소값과 최대값 추출
|
# 모든 옵션의 가격 범위에서 전체 최소값과 최대값 추출
|
||||||
if all_price_ranges:
|
if all_price_ranges:
|
||||||
|
|
@ -365,4 +365,4 @@ def update_price_range(driver, options_info, product_info):
|
||||||
|
|
||||||
logger.debug(f"전체 옵션의 가격 범위 업데이트: 최소값 {overall_min_price}, 최대값 {overall_max_price}")
|
logger.debug(f"전체 옵션의 가격 범위 업데이트: 최소값 {overall_min_price}, 최대값 {overall_max_price}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"가격 범위 업데이트 중 오류 발생: {e}")
|
logger.error(f"가격 범위 업데이트 중 오류 발생: {e}", exc_info=True)
|
||||||
|
|
@ -25,7 +25,7 @@ def edit_tag(driver, product_infos):
|
||||||
# EC.presence_of_element_located((By.CSS_SELECTOR, ".ant-tabs-tab:nth-child(4)"))
|
# EC.presence_of_element_located((By.CSS_SELECTOR, ".ant-tabs-tab:nth-child(4)"))
|
||||||
# )
|
# )
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"키워드 탭으로 이동 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
# logger.debug(f"키워드 탭으로 이동 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# # keyword_tab = driver.find_element(By.CSS_SELECTOR, "#rc-tabs-0-tab-3")
|
# # keyword_tab = driver.find_element(By.CSS_SELECTOR, "#rc-tabs-0-tab-3")
|
||||||
# keyword_tab.click()
|
# keyword_tab.click()
|
||||||
# keyword_tab_CSS = ".ant-tabs-tab:nth-child(4)"
|
# keyword_tab_CSS = ".ant-tabs-tab:nth-child(4)"
|
||||||
|
|
@ -41,7 +41,7 @@ def edit_tag(driver, product_infos):
|
||||||
# EC.presence_of_element_located((By.XPATH, "(//input[@value=''])[4]"))
|
# EC.presence_of_element_located((By.XPATH, "(//input[@value=''])[4]"))
|
||||||
# )
|
# )
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"키워드 입력 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
# logger.debug(f"키워드 입력 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# # keyword_input = driver.find_element(By.XPATH, "(//input[@value=''])[4]")
|
# # keyword_input = driver.find_element(By.XPATH, "(//input[@value=''])[4]")
|
||||||
# keyword_input.click()
|
# keyword_input.click()
|
||||||
# keyword_input.send_keys(product_title)
|
# keyword_input.send_keys(product_title)
|
||||||
|
|
@ -66,7 +66,7 @@ def edit_tag(driver, product_infos):
|
||||||
# EC.presence_of_element_located((By.CSS_SELECTOR, ".sc-bizigk > .ant-row:nth-child(3) span"))
|
# EC.presence_of_element_located((By.CSS_SELECTOR, ".sc-bizigk > .ant-row:nth-child(3) span"))
|
||||||
# )
|
# )
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"검색 버튼 클릭 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
# logger.debug(f"검색 버튼 클릭 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# search_button.click()
|
# search_button.click()
|
||||||
|
|
||||||
# 검색 버튼 클릭
|
# 검색 버튼 클릭
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ def modify_thumb_page(driver, product_info):
|
||||||
# )
|
# )
|
||||||
# thumb_tab_element.click()
|
# thumb_tab_element.click()
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"썸네일 탭 이동 중 에러 발생 : {e}")
|
# logger.debug(f"썸네일 탭 이동 중 에러 발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
# # 섬네일 개수 파악
|
# # 섬네일 개수 파악
|
||||||
thumbnail_edit_buttons = driver.find_elements(By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[4]/div/div/div/div[3]/div[2]/div")
|
thumbnail_edit_buttons = driver.find_elements(By.XPATH, "//div[@id='productMainContentContainerId']/div/div/div[4]/div/div/div/div[3]/div[2]/div")
|
||||||
|
|
@ -82,4 +82,4 @@ def edit_thumbnail(driver, index):
|
||||||
|
|
||||||
logger.debug(f"{index}번 섬네일 편집 완료")
|
logger.debug(f"{index}번 섬네일 편집 완료")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"{index}번 섬네일 편집 중 예외 발생: {e}")
|
logger.error(f"{index}번 섬네일 편집 중 예외 발생: {e}", exc_info=True)
|
||||||
|
|
@ -37,7 +37,7 @@ def modify_product_title(driver, product_infos):
|
||||||
EC.presence_of_element_located((By.XPATH, "//div[5]/div/span/input"))
|
EC.presence_of_element_located((By.XPATH, "//div[5]/div/span/input"))
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상품명 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"상품명 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
|
|
||||||
# product_infos에 저장된 최초 상품명과 옵션명들을 이용해 새로운 상품명을 조합
|
# product_infos에 저장된 최초 상품명과 옵션명들을 이용해 새로운 상품명을 조합
|
||||||
new_title = set_title(product_infos)
|
new_title = set_title(product_infos)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ def setup_logger(name, log_file, level=logging.DEBUG, max_bytes=10*1024*1024, ba
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
"""
|
"""
|
||||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
formatter = logging.Formatter('%(asctime)s - %(filename)s:%(lineno)d - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
|
|
||||||
# RotatingFileHandler를 사용하여 로그 파일 설정
|
# RotatingFileHandler를 사용하여 로그 파일 설정
|
||||||
handler = RotatingFileHandler(log_file, maxBytes=max_bytes, backupCount=backup_count, encoding='utf-8')
|
handler = RotatingFileHandler(log_file, maxBytes=max_bytes, backupCount=backup_count, encoding='utf-8')
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,13 @@ a = Analysis(
|
||||||
(os.path.join(spec_dir, 'models'), 'models'),
|
(os.path.join(spec_dir, 'models'), 'models'),
|
||||||
(os.path.join(spec_dir, 'Lib', 'site-packages', 'paddle', 'libs', '*.dll'), 'paddle\\libs'),
|
(os.path.join(spec_dir, 'Lib', 'site-packages', 'paddle', 'libs', '*.dll'), 'paddle\\libs'),
|
||||||
(os.path.join(spec_dir, 'config.ini'), '.')
|
(os.path.join(spec_dir, 'config.ini'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-Bold.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSans.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-ExtraBold.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-Regular.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'NotoSansKR-SemiBold.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'simfang.ttf'), '.')
|
||||||
|
(os.path.join(spec_dir, 'Percenty_SS_Code.json'), '.')
|
||||||
],
|
],
|
||||||
hiddenimports=[
|
hiddenimports=[
|
||||||
'shapely', 'pyclipper', 'imghdr', 'skimage', 'skimage.morphology._skeletonize', 'imgaug', 'scipy.io', 'lmdb', 'tqdm', 'paddlepaddle.core'
|
'shapely', 'pyclipper', 'imghdr', 'skimage', 'skimage.morphology._skeletonize', 'imgaug', 'scipy.io', 'lmdb', 'tqdm', 'paddlepaddle.core'
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ def perform_step(db, step_name, action, current_user, *args):
|
||||||
db.update_process_step(product_info.id, step_name, current_user)
|
db.update_process_step(product_info.id, step_name, current_user)
|
||||||
logger.debug(f"Step {step_name} completed for product {product_info.id}.")
|
logger.debug(f"Step {step_name} completed for product {product_info.id}.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error performing step {step_name} for product {product_info.id}: {e}")
|
logger.error(f"Error performing step {step_name} for product {product_info.id}: {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
def load_json_naver_codes(filename):
|
def load_json_naver_codes(filename):
|
||||||
|
|
@ -84,7 +84,7 @@ def load_json_naver_codes(filename):
|
||||||
item = json.loads(line)
|
item = json.loads(line)
|
||||||
codes.append(item)
|
codes.append(item)
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
logger.error(f"Error decoding JSON: {e}")
|
logger.error(f"Error decoding JSON: {e}", exc_info=True)
|
||||||
return codes
|
return codes
|
||||||
|
|
||||||
def wait_for_javascript(driver, timeout=20):
|
def wait_for_javascript(driver, timeout=20):
|
||||||
|
|
@ -108,7 +108,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
|
|
||||||
logger.debug(f"현재 작업중인 사용자 지정 : {current_user}")
|
logger.debug(f"현재 작업중인 사용자 지정 : {current_user}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"현재 작업중인 사용자 지정 중 에러발생 : {e}")
|
logger.debug(f"현재 작업중인 사용자 지정 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# MongoDB에 연결
|
# MongoDB에 연결
|
||||||
|
|
@ -119,7 +119,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
# products_collection = db['AutoPercenty_Produtcs']
|
# products_collection = db['AutoPercenty_Produtcs']
|
||||||
delv_collection = db['delv_fee']
|
delv_collection = db['delv_fee']
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"DB연결 중 에러발생 : {e}")
|
logger.debug(f"DB연결 중 에러발생 : {e}", exc_info=True)
|
||||||
|
|
||||||
set_num_modify = int(set_num_modify)
|
set_num_modify = int(set_num_modify)
|
||||||
logger.debug(f"수정대상 상품 수 설정 : {set_num_modify}")
|
logger.debug(f"수정대상 상품 수 설정 : {set_num_modify}")
|
||||||
|
|
@ -142,7 +142,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
logger.debug(f"총 상품수 : {total_products}")
|
logger.debug(f"총 상품수 : {total_products}")
|
||||||
total_pages = (total_products + 19) // 20
|
total_pages = (total_products + 19) // 20
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"총 상품 수 확인 중 오류 발생: 요소를 찾을 수 없습니다.{e}")
|
logger.debug(f"총 상품 수 확인 중 오류 발생: 요소를 찾을 수 없습니다.{e}", exc_info=True)
|
||||||
|
|
||||||
if set_num_modify == 0:
|
if set_num_modify == 0:
|
||||||
pass
|
pass
|
||||||
|
|
@ -183,7 +183,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
product_infos[i-1].id = product_id
|
product_infos[i-1].id = product_id
|
||||||
logger.debug(f"상품ID : {product_id}")
|
logger.debug(f"상품ID : {product_id}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상품ID 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"상품ID 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
# 상품ID 처리 여부 판단
|
# 상품ID 처리 여부 판단
|
||||||
|
|
@ -232,7 +232,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
continue # 다음 상품으로 넘어감
|
continue # 다음 상품으로 넘어감
|
||||||
# 여기서부터는 "상품명"이 확인되었거나, 다른 조건에 해당하는 경우 상품 수정 로직을 계속 진행합니다.
|
# 여기서부터는 "상품명"이 확인되었거나, 다른 조건에 해당하는 경우 상품 수정 로직을 계속 진행합니다.
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상품명 확인 중 오류 발생: {e}")
|
logger.debug(f"상품명 확인 중 오류 발생: {e}", exc_info=True)
|
||||||
continue # 해당 상품을 건너뛰고 다음 상품으로 넘어감
|
continue # 해당 상품을 건너뛰고 다음 상품으로 넘어감
|
||||||
|
|
||||||
# if i == 1:
|
# if i == 1:
|
||||||
|
|
@ -283,13 +283,13 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
product_infos[i-1].tao_low_price = product_low_cost
|
product_infos[i-1].tao_low_price = product_low_cost
|
||||||
product_infos[i-1].tao_high_price = product_high_cost
|
product_infos[i-1].tao_high_price = product_high_cost
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상품 상세 정보 수집 중 오류 발생: {e}")
|
logger.debug(f"상품 상세 정보 수집 중 오류 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
# 상품 이미지 복사
|
# 상품 이미지 복사
|
||||||
try:
|
try:
|
||||||
product_image_element = return_element(driver,"XPATH",f"//div[{i}]/li/div/div/div[1]/div/div[2]/div/div/img",10)
|
product_image_element = return_element(driver,"XPATH",f"//div[{i}]/li/div/div/div[1]/div/div[2]/div/div/img",10)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"상품 이미지 URL 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
logger.debug(f"상품 이미지 URL 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
product_image_url = product_image_element.get_attribute('src')
|
product_image_url = product_image_element.get_attribute('src')
|
||||||
product_infos[i-1].main_image_url = product_image_url
|
product_infos[i-1].main_image_url = product_image_url
|
||||||
logger.debug(f"product_image_url : {product_image_url}")
|
logger.debug(f"product_image_url : {product_image_url}")
|
||||||
|
|
@ -303,7 +303,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
|
|
||||||
# )
|
# )
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"상품 수정시작 중 오류 발생: 요소를 찾을 수 없습니다.{e}")
|
# logger.debug(f"상품 수정시작 중 오류 발생: 요소를 찾을 수 없습니다.{e}", exc_info=True)
|
||||||
|
|
||||||
# # product_title_element = driver.find_element(By.XPATH, (f"//div[{i}]/li/div/div/div[2]/div/div/div/div"))
|
# # product_title_element = driver.find_element(By.XPATH, (f"//div[{i}]/li/div/div/div[2]/div/div/div/div"))
|
||||||
# driver.execute_script("arguments[0].click();", product_title_element)# 상품 수정 페이지 자바스크립트로 열기
|
# driver.execute_script("arguments[0].click();", product_title_element)# 상품 수정 페이지 자바스크립트로 열기
|
||||||
|
|
@ -334,7 +334,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
|
|
||||||
# )
|
# )
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"상품 이미지 주소 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
# logger.debug(f"상품 이미지 주소 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# # image_element = driver.find_element(By.CSS_SELECTOR, ".sc-gFnajm")
|
# # image_element = driver.find_element(By.CSS_SELECTOR, ".sc-gFnajm")
|
||||||
# image_src = image_element.get_attribute("src")
|
# image_src = image_element.get_attribute("src")
|
||||||
# logger.debug(f"상품 이미지 주소 : {image_src}")
|
# logger.debug(f"상품 이미지 주소 : {image_src}")
|
||||||
|
|
@ -347,7 +347,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
# EC.presence_of_element_located((By.XPATH, "//div[5]/div/span/input"))
|
# EC.presence_of_element_located((By.XPATH, "//div[5]/div/span/input"))
|
||||||
# )
|
# )
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"상품명 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}")
|
# logger.debug(f"상품명 복사 중 오류 발생: 요소를 찾을 수 없습니다. : {e}", exc_info=True)
|
||||||
# # product_title_element = driver.find_element(By.XPATH, "//div[5]/div/span/input")
|
# # product_title_element = driver.find_element(By.XPATH, "//div[5]/div/span/input")
|
||||||
# product_title = product_title_element.get_attribute("value")
|
# product_title = product_title_element.get_attribute("value")
|
||||||
|
|
||||||
|
|
@ -370,7 +370,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
# perform_step(autoPercentyProductsDB, 'price_modification', product_infos[i-1], current_user, driver)
|
# perform_step(autoPercentyProductsDB, 'price_modification', product_infos[i-1], current_user, driver)
|
||||||
# logger.debug("모든 단계의 수정 작업이 완료되었습니다.")
|
# logger.debug("모든 단계의 수정 작업이 완료되었습니다.")
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.error(f"수정 작업 중 예외 발생: {e}")
|
# logger.error(f"수정 작업 중 예외 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
# logger.debug("키워드 수정작업 시작")
|
# logger.debug("키워드 수정작업 시작")
|
||||||
# edit_tag(driver, product_infos[i-1])
|
# edit_tag(driver, product_infos[i-1])
|
||||||
|
|
@ -415,7 +415,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
logger.debug(f"진행 상황: {completed_products}/{total_products} ({(completed_products/total_products)*100:.2f}%)")
|
logger.debug(f"진행 상황: {completed_products}/{total_products} ({(completed_products/total_products)*100:.2f}%)")
|
||||||
|
|
||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.debug(f"상품 {i} 확인 중 오류 발생: {e}")
|
# logger.debug(f"상품 {i} 확인 중 오류 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
# 다음 페이지로 이동
|
# 다음 페이지로 이동
|
||||||
if current_page < total_pages:
|
if current_page < total_pages:
|
||||||
|
|
@ -430,7 +430,7 @@ def modify_products(driver, gemini, mongo_config, login_info, set_num_modify):
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
current_page += 1
|
current_page += 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"다음 페이지로 이동하는 중 오류 발생: {e}")
|
logger.debug(f"다음 페이지로 이동하는 중 오류 발생: {e}", exc_info=True)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logger.debug("모든 페이지 처리 완료. 작업 종료.")
|
logger.debug("모든 페이지 처리 완료. 작업 종료.")
|
||||||
|
|
|
||||||
|
|
@ -76,5 +76,5 @@ class MongoConfig:
|
||||||
logger.debug("MongoDB 연결 성공.")
|
logger.debug("MongoDB 연결 성공.")
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"MongoDB 연결 실패: {e}")
|
logger.debug(f"MongoDB 연결 실패: {e}", exc_info=True)
|
||||||
return False
|
return False
|
||||||
|
|
@ -37,7 +37,7 @@ def parse_naver_shopping(keyword, naver_code, isOverseas=1, sortcount=10):
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
response.raise_for_status() # 만약 요청이 실패하면 예외 발생
|
response.raise_for_status() # 만약 요청이 실패하면 예외 발생
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logger.debug(f"네이버 쇼핑 HTML을 가져오는 중 오류 발생: {e}")
|
logger.debug(f"네이버 쇼핑 HTML을 가져오는 중 오류 발생: {e}", exc_info=True)
|
||||||
# 예외 처리 코드 추가
|
# 예외 처리 코드 추가
|
||||||
|
|
||||||
soup = BeautifulSoup(response.text, 'html.parser')
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ def modify_products(driver):
|
||||||
log(f"진행 상황: {completed_products}/{total_products} ({(completed_products/total_products)*100:.2f}%)")
|
log(f"진행 상황: {completed_products}/{total_products} ({(completed_products/total_products)*100:.2f}%)")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"상품 {i} 확인 중 오류 발생: {e}")
|
log(f"상품 {i} 확인 중 오류 발생: {e}", exc_info=True)
|
||||||
|
|
||||||
# 다음 페이지로 이동
|
# 다음 페이지로 이동
|
||||||
if current_page < total_pages:
|
if current_page < total_pages:
|
||||||
|
|
@ -50,7 +50,7 @@ def modify_products(driver):
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
current_page += 1
|
current_page += 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"다음 페이지로 이동하는 중 오류 발생: {e}")
|
log(f"다음 페이지로 이동하는 중 오류 발생: {e}", exc_info=True)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
log("모든 페이지 처리 완료. 작업 종료.")
|
log("모든 페이지 처리 완료. 작업 종료.")
|
||||||
|
|
@ -90,7 +90,7 @@ def navigate_to_new_product_registration(driver):
|
||||||
log(f"상품 {product_id} 처리 완료.")
|
log(f"상품 {product_id} 처리 완료.")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"상품 {i} 확인 중 오류 발생: {e}")
|
log(f"상품 {i} 확인 중 오류 발생: {e}", exc_info=True)
|
||||||
continue
|
continue
|
||||||
# 다음 페이지로 이동
|
# 다음 페이지로 이동
|
||||||
try:
|
try:
|
||||||
|
|
@ -101,5 +101,5 @@ def navigate_to_new_product_registration(driver):
|
||||||
next_page_button.click()
|
next_page_button.click()
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"다음 페이지로 이동하는 중 오류 발생: {e}")
|
log(f"다음 페이지로 이동하는 중 오류 발생: {e}", exc_info=True)
|
||||||
break
|
break
|
||||||
Loading…
Reference in New Issue