|
@@ -322,7 +322,7 @@ def crawl_with_selenium(url, mark):
|
|
|
time.sleep(5)
|
|
|
base_mysql.update_shandong_yoy('浙江省')
|
|
|
log.info("浙江省海关城市同比sql处理完成")
|
|
|
- return 'finish'
|
|
|
+ return 'finish', year_month
|
|
|
|
|
|
def wait_for_download_complete(timeout=30, existing_files=None):
|
|
|
"""
|
|
@@ -406,10 +406,12 @@ def main():
|
|
|
else:
|
|
|
log.info("正在增量采集浙江省海关数据")
|
|
|
res = crawl_with_selenium('http://hangzhou.customs.gov.cn/hangzhou_customs/575609/zlbd/575612/575612/6430241/6430315/index.html','auto')
|
|
|
- if res == 'finish':
|
|
|
- duration = time.time() - start_time
|
|
|
- minutes, seconds = divmod(duration, 60)
|
|
|
- send_dingtalk_message(f'【浙江省海关】增量数据采集完成,耗时 {int(minutes)}分{seconds:.1f}秒')
|
|
|
+ if res is not None:
|
|
|
+ r1, r2 = res
|
|
|
+ if r1 == 'finish':
|
|
|
+ duration = time.time() - start_time
|
|
|
+ minutes, seconds = divmod(duration, 60)
|
|
|
+ send_dingtalk_message(f'【浙江省海关】增量数据采集完成,耗时 {int(minutes)}分{seconds:.1f}秒')
|
|
|
|
|
|
except Exception as e:
|
|
|
send_dingtalk_message(f"【浙江省海关】发生错误:{e}")
|