Browse Source

调整治理

baoyubo 8 months ago
parent
commit
d58aee189f
1 changed files with 4 additions and 2 deletions
  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