Ver código fonte

Merge branch 'master' of http://192.168.0.202:8087/xzc/resume-parse

sprivacy 3 anos atrás
pai
commit
e78f056ccf
1 arquivos alterados com 19 adições e 6 exclusões
  1. 19 6
      tools/resume_parse.py

+ 19 - 6
tools/resume_parse.py

@@ -11,6 +11,8 @@ import rarfile
 import py7zr
 import tarfile
 from zipfile import ZipFile
+import requests
+from requests.adapters import HTTPAdapter
 
 import logging
 
@@ -141,19 +143,19 @@ def get_base_info(lines):
     if rst.get("出生日期"):
         dates = re.findall(r'\d+' ,rst["出生日期"][0]["text"])
         if len(dates) == 1:
-            rst["出生日期"][0]["text"] = "{:4d}年01月".format(int(dates[0]))
+            rst["出生日期"][0]["text"] = "{:4d}-01-01".format(int(dates[0]))
         elif len(dates) == 2:
-            rst["出生日期"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
+            rst["出生日期"][0]["text"] = "{:4d}-{:02d}-01".format(int(dates[0]), int(dates[1]))
         elif len(dates) == 3:
-            rst["出生日期"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
+            rst["出生日期"][0]["text"] = "{:4d}-{:02d}-01".format(int(dates[0]), int(dates[1]))
     if rst.get("参加工作时间"):
         dates = re.findall(r'\d+' ,rst["参加工作时间"][0]["text"])
         if len(dates) == 1:
-            rst["参加工作时间"][0]["text"] = "{:4d}年01月".format(int(dates[0]))
+            rst["参加工作时间"][0]["text"] = "{:4d}-01-01".format(int(dates[0]))
         elif len(dates) == 2:
-            rst["参加工作时间"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
+            rst["参加工作时间"][0]["text"] = "{:4d}-{:02d}-01".format(int(dates[0]), int(dates[1]))
         elif len(dates) == 3:
-            rst["参加工作时间"][0]["text"] = "{:4d}年{:02d}月".format(int(dates[0]), int(dates[1]))
+            rst["参加工作时间"][0]["text"] = "{:4d}-{:02d}-01".format(int(dates[0]), int(dates[1]))
     return {key:rst[key][0]["text"] for key in rst.keys()}
 
 
@@ -1481,6 +1483,17 @@ def detection_type(path, system):
         filename = os.path.join(tempdir, file)
         with open(filename, "r", encoding="utf-8") as ff:
             rst = json.load(ff)
+        url = "http://192.168.1.110:9999/talent/getResumeData"
+        session = requests.Session()
+        session.mount('http://', HTTPAdapter(max_retries = 3))
+        try:
+            headers = {
+                'contentType':'Application/json'
+            }
+            response = session.post(url=url, headers=headers, json={"ResumeData":rst}, timeout=10)
+            print(response.text)
+        except Exception as e:
+            print(e)
         console.print(rst, style="red", justify="left")