not parse airports wo city
This commit is contained in:
SDE
2023-08-07 23:45:10 +03:00
parent bf67fc98a7
commit eaab071a1e
2 changed files with 7 additions and 3 deletions

View File

@@ -266,8 +266,8 @@ def osm_get_country_w_cities_n_airports(country_Dict, area_id):
country_Dict['parsing_status'] = 'finished' country_Dict['parsing_status'] = 'finished'
airports_wo_city = [] airports_wo_city = []
if airports_Dict and None in airports_Dict: # if airports_Dict and None in airports_Dict:
airports_wo_city = airports_Dict[None] # airports_wo_city = airports_Dict[None]
return country_Dict, airports_wo_city return country_Dict, airports_wo_city

View File

@@ -57,6 +57,8 @@ def create_airports_by_airportsList(airportsList, city=None):
if airport_Dict['iata']: if airport_Dict['iata']:
kwargs.update({'iata_code': airport_Dict['iata']}) kwargs.update({'iata_code': airport_Dict['iata']})
airport = Airport.objects.get(**kwargs) airport = Airport.objects.get(**kwargs)
except Airport.DoesNotExist:
print(f'{airport_Dict["int_name"]} не найден в БД > добавляем')
except Exception as e: except Exception as e:
print(f'error = {str(e)}') print(f'error = {str(e)}')
@@ -122,7 +124,7 @@ def parse_data():
continue continue
except Country.DoesNotExist: except Country.DoesNotExist:
pass print(f'{country_item["ISO3166-1"]} не найдена в БД > добавляем')
except Exception as e: except Exception as e:
print(f'error = {str(e)}') print(f'error = {str(e)}')
@@ -181,6 +183,8 @@ def parse_data():
try: try:
city = City.objects.get(**kwargs) city = City.objects.get(**kwargs)
except City.DoesNotExist:
print(f'{city_Dict["name:en"]} не найдена в БД > добавляем')
except Exception as e: except Exception as e:
print(f'error = {str(e)}') print(f'error = {str(e)}')