Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
def getProperty(status, propertyNames): # Cохраняем все содержимое status property = status # Пытаемся найти нужный ключ try: # Перебираем каждый ключ из propertyNames for propertyName in propertyNames: # Отсекаем ненужное property = property[propertyName] # Нужный ключ найден! return property except # А если нет, то возвращаем заглушку return "---"
# Cохраняем все содержимое status property = status
try:
dateLocal = data['operationalTimes']['actualGateDeparture']['dateLocal']
except:
dateLocal = '---'
interestingEquipments = ["SU9"] # Sukhoi Superjet 100.{
"request": {
"url": "https://api.flightstats.com/flex/weather/rest/v1/json/metar/ULLI",
"airport": {
"requestedCode": "ULLI",
"fsCode": "LED"
},
"codeType": {}
},
"metar": {
"report": "ULLI 081130Z 00000MPS 9999 -SN SCT010 OVC018 M03/M04 Q1008 60590336 10////// NOSIG",
"reportTime": "2013-12-08T11:30:00.000Z",
"weatherStationIcao": "ULLI",
"tags": [
{
"key": "Precipitation",
"value": "2"
},
{
"key": "Freezing",
"value": "4"
},
{
"key": "Instrumentation",
"value": "MVFR"
},
{
"key": "Prevailing Conditions",
"value": "Snow"
}
],
"conditions": {
"wind": {
"direction": 0,
"directionIsVariable": false,
"speedKnots": "0.00"
},
"visibility": {
"miles": "6.21",
"lessThan": false,
"cavok": false
},
"weatherConditions": [
{
"phenomenon": "Snow",
"intensity": "Light"
}
],
"skyConditions": [
{
"coverage": "Scattered clouds",
"base": 1000
},
{
"coverage": "Overcast",
"base": 1800
}
],
"pressureInchesHg": "29.77"
},
"temperatureCelsius": "-3.00",
"dewPointCelsius": "-4.00",
"runwayVisualRanges": [],
"obscurations": [],
"noSignificantChange": true
},
"appendix": {
"airports": [
{
"fs": "LED",
"iata": "LED",
"icao": "ULLI",
"name": "Pulkovo Airport",
"city": "Saint Petersburg",
"cityCode": "LED",
"countryCode": "RU",
"countryName": "Russian Federation",
"regionName": "Europe",
"timeZoneRegionName": "Europe/Moscow",
"localTime": "2013-12-08T16:14:21.111",
"utcOffsetHours": 4,
"latitude": 59.806085,
"longitude": 30.3083,
"elevationFeet": 79,
"classification": 2,
"active": true,
"delayIndexUrl": "https://api.flightstats.com/flex/delayindex/rest/v1/json/airports/LED?codeType=fs"
}
]
}
}А кто подскажет, к этому апи можно подцепиться и получать инфу о самолётах в воздухе для нужной зоны в реальном времени?
Для контроля зоны, где летают авиамоделисты, свободна ли она.
Flightstats API: Пишем свое табло прилетов с Боингами и Аэробусами