luojunhui hai 3 meses
pai
achega
122ddbf3a3
Modificáronse 1 ficheiros con 14 adicións e 3 borrados
  1. 14 3
      account_association_task.py

+ 14 - 3
account_association_task.py

@@ -2,9 +2,12 @@
 @author: luojunhui
 账号联想---账号搜索任务
 """
+import traceback
+
 from argparse import ArgumentParser
 from datetime import datetime
 
+from applications import bot
 from coldStartTasks.crawler.weixin_account_association_crawler import AccountAssociationCrawler
 
 
@@ -23,9 +26,17 @@ def main():
         biz_date = datetime.strptime(args.run_date, "%Y-%m-%d")
     else:
         biz_date = datetime.today()
-
-    account_association_crawler = AccountAssociationCrawler()
-    account_association_crawler.run_account_association(biz_date=biz_date)
+    try:
+        account_association_crawler = AccountAssociationCrawler()
+        account_association_crawler.run_account_association(biz_date=biz_date)
+    except Exception as e:
+        bot(
+            title="账号联想任务失败",
+            detail={
+                "error": str(e),
+                "error_stack": traceback.format_exc()
+            }
+        )
 
 
 if __name__ == '__main__':