Преглед изворни кода

2.0 药房网 京东更新

OLIN пре 4 недеља
родитељ
комит
8264b49e30

BIN
commons/__pycache__/Logger.cpython-313.pyc


BIN
commons/__pycache__/collect_schedule_runner.cpython-313.pyc


BIN
commons/__pycache__/config.cpython-313.pyc


BIN
commons/__pycache__/conn_mysql.cpython-313.pyc


BIN
commons/__pycache__/feishu_webhook.cpython-313.pyc


BIN
commons/__pycache__/scheduler.cpython-313.pyc


BIN
commons/__pycache__/sql_data.cpython-313.pyc


+ 1 - 1
commons/config.py

@@ -3,7 +3,7 @@
 JD_DEVICE_ID = 4
 
 #淘宝设备id,对应数据库账号表的id
-TB_DEVICE_ID= 4
+TB_DEVICE_ID= 1
 
 # 药师帮账号
 YSB_ACCOUNT = {

+ 13 - 0
commons/conn_mysql.py

@@ -156,6 +156,19 @@ class MySQLPoolOnline(_MySQLPoolBase):
         )
         super().__init__(pool)
 
+class MySQLPoolOn2(_MySQLPoolBase):
+    """drug_retrieve 库。"""
+
+    def __init__(self):
+        pool = _create_pool(
+            host=os.environ.get("MYSQL_DRUG_HOST", "120.24.26.108"),
+            port=int(os.environ.get("MYSQL_DRUG_PORT", "3307")),
+            user=os.environ.get("MYSQL_DRUG_USER", "root"),
+            password=os.environ.get("MYSQL_DRUG_PASSWORD", "zhijiayun123456"),
+            database=os.environ.get("MYSQL_DRUG_DB", "drug_retrieve_test"),
+        )
+        super().__init__(pool)
+
 
 if __name__ == "__main__":
     pool = MySQLPool()

+ 2 - 2
pipelines/drug_pipelines.py

@@ -3,7 +3,7 @@ import time
 from itertools import product
 from pathlib import Path
 from area_info.city_name_to_id_2 import get_city
-from commons.conn_mysql import MySQLPool39, MySQLPoolOnline
+from commons.conn_mysql import MySQLPoolOn2, MySQLPoolOnline
 from commons.sql_data import RETRIEVE_SCRAPE_INSERT_COLUMNS, sql_map
 from commons.Logger import get_spider_logger
 from pipelines.shop_pipelines import ShopPipeline
@@ -11,7 +11,7 @@ from pipelines.shop_pipelines import ShopPipeline
 
 class DrugPipeline:
     def __init__(self, spider_name: str):
-        self.db_online = MySQLPool39()
+        self.db_online = MySQLPoolOn2()
         # self.db_online = MySQLPoolOnline()
         self.sql_map = sql_map
         self.crawl_count = 0