Я пытаюсь получить данные от публичного API от Schiphol (аэропорт в Амстердаме).
Im получаю этот API от https://api.schiphol.nl/public-flights/flights.
Я использую питон, чтобы получить данные полета. В моем коде я получаю ошибку, что «app_id» не является, пока это заполнено .... < /p>
Полная ошибка из консоли:
Использование: FLERS_INFO_API.PY [Параметры] < /p>
flight_INFO_API.PY: error: urress uepd ad (-и,-PRID) < /> < /> < /> < /> < /> < /> < /> ruck-yr /> ruckmy_iNFO_PI. /> Кто -нибудь может увидеть, что идет не так?import requests
import sys
import optparse
def callPublicFlightAPI(options):
url = 'https://api.schiphol.nl/public-flights/flights'
headers = {
'resourceversion': 'v4',
'app_id': 'b209eb7f',
'app_key': '0b6c58b5ae4595dd39785b55f438fc70'
}
try:
response = requests.request('GET', url, headers=headers)
except requests.exceptions.ConnectionError as error:
print(error)
sys.exit()
if response.status_code == 200:
flightList = response.json()
print('found {} flights.'.format(len(flightList['flights'])))
for flight in flightList['flights']:
print('Found flight with name: {} scheduled on: {} at {}'.format(flight['flightName'],
flight['scheduleDate'],
flight['scheduleTime']))
else:
print('''Oops something went wrong Http response code: {}{}'''.format(response.status_code, response.text))
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option('-i', '--app_id', dest='app_id',
help='App id used to call the API')
parser.add_option('-k', '--app_key', dest='app_key',
help='App key used to call the API')
(options, args) = parser.parse_args()
if options.app_id is None:
parser.error('Please provide an app id (-i, --app_id)')
if options.app_key is None:
parser.error('Please provide an app key (-key, --app_key)')
callPublicFlightAPI(options)
Подробнее здесь: https://stackoverflow.com/questions/611 ... gets-error
Schiphol Flight API, получение информации о полете с Python получает ошибку ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Rocketpy: не может получить доступ к Flight.x, Flight.y, Flight.z Значения
Anonymous » » в форуме Python - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Как исправить «Запрошенное приложение недоступно или не существует». в тестовом полете
Anonymous » » в форуме IOS - 0 Ответы
- 50 Просмотры
-
Последнее сообщение Anonymous
-