oafuncs 0.0.71__tar.gz → 0.0.72__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {oafuncs-0.0.71 → oafuncs-0.0.72}/PKG-INFO +1 -1
  2. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_down/hycom_3hourly.py +27 -2
  3. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs.egg-info/PKG-INFO +1 -1
  4. {oafuncs-0.0.71 → oafuncs-0.0.72}/setup.py +1 -1
  5. {oafuncs-0.0.71 → oafuncs-0.0.72}/LICENSE.txt +0 -0
  6. {oafuncs-0.0.71 → oafuncs-0.0.72}/README.md +0 -0
  7. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/__init__.py +0 -0
  8. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_cmap.py +0 -0
  9. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_data.py +0 -0
  10. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_down/__init__.py +0 -0
  11. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_down/literature.py +0 -0
  12. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_down/refs_pdf.py +0 -0
  13. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_draw.py +0 -0
  14. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_file.py +0 -0
  15. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_help.py +0 -0
  16. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_nc.py +0 -0
  17. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_python.py +0 -0
  18. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_sign/__init__.py +0 -0
  19. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_sign/meteorological.py +0 -0
  20. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_sign/ocean.py +0 -0
  21. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_sign/scientific.py +0 -0
  22. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_tool/__init__.py +0 -0
  23. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs/oa_tool/email.py +0 -0
  24. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs.egg-info/SOURCES.txt +0 -0
  25. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs.egg-info/dependency_links.txt +0 -0
  26. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs.egg-info/requires.txt +0 -0
  27. {oafuncs-0.0.71 → oafuncs-0.0.72}/oafuncs.egg-info/top_level.txt +0 -0
  28. {oafuncs-0.0.71 → oafuncs-0.0.72}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oafuncs
3
- Version: 0.0.71
3
+ Version: 0.0.72
4
4
  Summary: My short description for my project.
5
5
  Home-page: https://github.com/Industry-Pays/OAFuncs
6
6
  Author: Kun Liu
@@ -4,7 +4,7 @@
4
4
  Author: Liu Kun && 16031215@qq.com
5
5
  Date: 2024-11-01 10:31:09
6
6
  LastEditors: Liu Kun && 16031215@qq.com
7
- LastEditTime: 2024-12-01 11:21:49
7
+ LastEditTime: 2024-12-01 11:45:18
8
8
  FilePath: \\Python\\My_Funcs\\OAFuncs\\oafuncs\\oa_down\\hycom_3hourly.py
9
9
  Description:
10
10
  EditPlatform: vscode
@@ -602,6 +602,31 @@ def dlownload_file(target_url, store_path, file_name, check=False):
602
602
  request_times = 0
603
603
  filename = Path(store_path) / file_name
604
604
 
605
+ def calculate_wait_time(time_str):
606
+ import re
607
+
608
+ # 定义正则表达式,匹配YYYYMMDDHH格式的时间
609
+ time_pattern = r'\d{10}'
610
+
611
+ # 定义两个字符串
612
+ # str1 = 'HYCOM_water_u_2018010100_2018010112.nc'
613
+ # str2 = 'HYCOM_water_u_2018010100.nc'
614
+
615
+ # 使用正则表达式查找时间
616
+ times_in_str = re.findall(time_pattern, time_str)
617
+
618
+ # 计算每个字符串中的时间数量
619
+ num_times_str = len(times_in_str)
620
+
621
+ if num_times_str > 1:
622
+ delta_t = datetime.datetime.strptime(times_in_str[1], '%Y%m%d%H') - datetime.datetime.strptime(times_in_str[0], '%Y%m%d%H')
623
+ delta_t = delta_t.total_seconds() / 3600
624
+ delta_t = delta_t / 3 + 1
625
+
626
+ return int(delta_t*15)
627
+
628
+ max_timeout = calculate_wait_time(file_name)
629
+
605
630
  if check:
606
631
  if check_existing_file(filename):
607
632
  return
@@ -620,7 +645,7 @@ def dlownload_file(target_url, store_path, file_name, check=False):
620
645
  # 尝试下载文件
621
646
  try:
622
647
  headers = {'User-Agent': get_ua()}
623
- response = s.get(target_url, headers=headers, timeout=random.randint(5, 15))
648
+ response = s.get(target_url, headers=headers, timeout=random.randint(5, max_timeout))
624
649
  response.raise_for_status() # 如果请求返回的不是200,将抛出HTTPError异常
625
650
 
626
651
  # 保存文件
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oafuncs
3
- Version: 0.0.71
3
+ Version: 0.0.72
4
4
  Summary: My short description for my project.
5
5
  Home-page: https://github.com/Industry-Pays/OAFuncs
6
6
  Author: Kun Liu
@@ -18,7 +18,7 @@ URL = 'https://github.com/Industry-Pays/OAFuncs'
18
18
  EMAIL = 'liukun0312@stu.ouc.edu.cn'
19
19
  AUTHOR = 'Kun Liu'
20
20
  REQUIRES_PYTHON = '>=3.9.0'
21
- VERSION = '0.0.71'
21
+ VERSION = '0.0.72'
22
22
 
23
23
  # What packages are required for this module to be executed?
24
24
  REQUIRED = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes