Skip to content

Commit

Permalink
0.9.35 data client 支持自动重试机制
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Nov 9, 2023
1 parent b5c9db7 commit ff206f4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions czsc/utils/data_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path
from loguru import logger
from functools import partial
from tenacity import retry, stop_after_attempt, wait_fixed


def set_url_token(token, url):
Expand Down Expand Up @@ -63,6 +64,7 @@ def clear_cache(self):
shutil.rmtree(self.cache_path)
logger.info(f"{self.cache_path} 路径下的数据缓存已清空")

@retry(stop=stop_after_attempt(3), wait=wait_fixed(10), reraise=True)
def post_request(self, api_name, fields='', **kwargs):
"""执行API数据查询
Expand Down

0 comments on commit ff206f4

Please sign in to comment.