feat: MySQL DB 연동 및 크롤링 로직 정상화 (ID 매칭 및 데이터 정밀화)

This commit is contained in:
2026-03-10 14:11:49 +09:00
parent 9369e18eb8
commit 743cce543b
21 changed files with 696 additions and 204 deletions

33
test_main_filtered.py Normal file
View File

@@ -0,0 +1,33 @@
import asyncio, os, json, queue, threading
from crawler_service import crawler_thread_worker
from dotenv import load_dotenv
load_dotenv()
async def run_main_test():
user_id = os.getenv("PM_USER_ID")
password = os.getenv("PM_PASSWORD")
msg_queue = queue.Queue()
thread = threading.Thread(target=crawler_thread_worker, args=(msg_queue, user_id, password))
thread.start()
print(">>> 메인 워커 실행 중 (필리핀 사무소)...")
try:
while True:
msg_raw = await asyncio.to_thread(msg_queue.get, timeout=300)
if msg_raw is None: break
msg = json.loads(msg_raw)
if msg["type"] == "log":
print(f"[LOG] {msg['message']}")
elif msg["type"] == "done":
print(f"\n[DONE] 최종 결과: {msg['data']}")
break
except queue.Empty:
print(">>> 타임아웃")
finally:
thread.join()
if __name__ == "__main__":
asyncio.run(run_main_test())