Broadly, the Lumo APIs are designed to help keep travelers, travel agents, and others informed about their flights. The Lumo API makes it possible to get rich, comprehensive data – including flight delay predictions, real-time data, weather alerts, COVID stats, and more – through a single API call. Data from Lumo's API can be used at the time of booking to help travelers choose better flights, or to monitor flights post-booking to send relevant and timely alerts.
The API contains the following types of data:
Lumo provides two types of keys
Python
import requests
import json
API_KEY="YOUR-API-KEY-HERE"
ENV="test" #Use either test or prod
if ENV == 'test':
headers = {
'x-api-key': API_KEY,
"Content-type": "application/json"
}
base_url = 'https://sandbox-api.thinklumo.com/flights/v1'
else:
headers = {
'Token': API_KEY,
"Content-type": "application/json"
}
base_url = 'https://api.thinklumo.com/flights/v1'
#-------------------------------------------------------------------------------
# Retrieve the status of a flight given a flight id
# Format of the flight id is [IATA carrier code][flight number][departure airport][arrival airport][scheduled departure time as YYMMDDHHMM in UTC time]
#
def status_with_flight_id():
flght_id = 'AA38MIALHR2010082235'
r = requests.get(f'{base_url}/status/{flght_id}', headers=headers)
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Retrieve the status of a flight given flight parameters
#
def status_with_params():
params = {
'carrier': 'WN',
'flight_number': 822,
'origin': 'HOU',
'date': '2020-10-09'
}
r = requests.get(f'{base_url}/status', headers=headers, params=params)
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Retrieve the connection risk for a pair of flights
# flights are comma-separated IDs
# [IATA carrier code][flight number][departure airport][arrival airport][scheduled departure date as YYMMDD in local time]
#
def connection_with_params():
params = {
'flights': 'LH2230MUCCDG201011,AF1280CDGLHR201011'
}
r = requests.get(f'{base_url}/connection', headers=headers, params=params)
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Retrieve alternative flights with a lower risk of delay
# Format of the flight id is [IATA carrier code][flight number][departure airport][arrival airport][scheduled departure time as YYMMDDHHMM in UTC time]
#
def alternates_with_flight_id():
flght_id='AA2421MIASFO2010152345'
r = requests.get(f'{base_url}/alternates/{flght_id}', headers=headers)
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Retrieve the results of flight search based on parameters
#
def search_with_params():
params = {
'origin': 'BOS',
'destination': 'LGA',
'date': '2020-10-20'
}
r = requests.get(f'{base_url}/search', headers=headers, params=params)
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Create a subscription
#
def subscription_with_flight_id():
data = {
'flight_ids': ['LH2230MUCCDG201011','AF1280CDGLHR201011'],
'booking_reference': 'ABCDEF'
}
r = requests.post(f'{base_url}/subscriptions', headers=headers, data=json.dumps(data))
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Retrieve all your subscriptions
#
def get_all_subscriptions():
r = requests.get(f'{base_url}/subscriptions', headers=headers)
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Retrieve a specific subscription based on the itinerary id
#
def get_specific_subscription():
itinerary_id='c9686e9b-6158-40c5-a8fc-723735c53b8c'
r = requests.get(f'{base_url}/subscriptions/{itinerary_id}', headers=headers)
print(f'{r.status_code}: {r.text}')
#-------------------------------------------------------------------------------
# Delete a specific subscription based on the itinerary id
#
def delete_specific_subscription():
itinerary_id='c9686e9b-6158-40c5-a8fc-723735c53b8c'
r = requests.delete(f'{base_url}/subscriptions/{itinerary_id}', headers=headers)
print(f'{r.status_code}: {r.text}')
Documentation is at developer.thinklumo.com