1.6.1 parsing timezones
This commit is contained in:
@@ -213,7 +213,8 @@ def parse_data():
|
||||
geo_lat = float(city_Dict['@lat'])
|
||||
geo_lon = float(city_Dict['@lon'])
|
||||
tz = tzf.timezone_at(lng=geo_lon, lat=geo_lat)
|
||||
print(f'city {city_Dict["name:en"]} - {tz}')
|
||||
if not city or not city.timezone:
|
||||
print(f'city {city_Dict["name:en"]} - {tz}')
|
||||
|
||||
# собираем данные
|
||||
city_kwargs = {
|
||||
@@ -256,11 +257,12 @@ def parse_data():
|
||||
hash_data = hashlib.md5(json.dumps(country_Dict, sort_keys=True, ensure_ascii=True).encode('utf-8')).hexdigest()
|
||||
country.add_node_to_json_data({'hash': hash_data})
|
||||
|
||||
country.timezone = tzf.timezone_at(lng=float(country.geo_lon), lat=float(country.geo_lat))
|
||||
print(f'country {country.name} - {country.timezone}')
|
||||
if not country.timezone:
|
||||
country.timezone = tzf.timezone_at(lng=float(country.geo_lon), lat=float(country.geo_lat))
|
||||
print(f'country {country.name} - {country.timezone}')
|
||||
|
||||
if 'parsing_status' in country_Dict and country_Dict['parsing_status'] == 'finished':
|
||||
country.parsing_finished_DT = datetime.now()
|
||||
country.save(update_fields=['parsing_finished_DT'])
|
||||
country.save()
|
||||
|
||||
return True
|
||||
Reference in New Issue
Block a user