Browse Source

从巨量引擎分页获取数据发生异常时,在异常捕获代码添加has_more=False,用来结束请求

liyuyi@c-top.com.cn 3 years ago
parent
commit
84b58950fe
1 changed files with 1 additions and 0 deletions
  1. 1 0
      get_material_and_script/get_material_from_ocean_engine.py

+ 1 - 0
get_material_and_script/get_material_from_ocean_engine.py

@@ -56,6 +56,7 @@ class GetMaterialFromOceanEngine(object):
                 else:
                 else:
                     has_more = False
                     has_more = False
             except:
             except:
+                has_more = False
                 self.logger.error(f"查询词:{self.query_word}, 调用头条巨量引擎物料接口,分页获取时发生异常信息: {traceback.format_exc()}")
                 self.logger.error(f"查询词:{self.query_word}, 调用头条巨量引擎物料接口,分页获取时发生异常信息: {traceback.format_exc()}")
 
 
         self.logger.info(f"查询词:{self.query_word}, 调用头条巨量引擎物料接口, 执行结束,共 {len(material_df)} 个物料信息!")
         self.logger.info(f"查询词:{self.query_word}, 调用头条巨量引擎物料接口, 执行结束,共 {len(material_df)} 个物料信息!")