瀏覽代碼

调整治理

baoyubo 8 月之前
父節點
當前提交
d58aee189f
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      DataGovernance.py

+ 4 - 2
DataGovernance.py

@@ -23,8 +23,10 @@ def jwd_to_area(location):
     }
     response = requests.post(url=url, headers=headers, json=location, verify=False)
     if response.status_code == 200:
-        return response.json()['data'][0]['district']
-
+        try:
+            return response.json()['data'][0]['district']
+        except:
+            return None
 def put_area(table : str,longitude='longitude',latitude='latitude'):
     conn=None
     cur = None