TSA API

The MyTSA Web Service API supports several features, some of which include: Security Checkpoint Wait Times, TSA Pre-Check locations, and Sunrise/Sunset times for all locations. Data can be queried by state and/or airport. The TSA provides XML files of data in addition to the API with documentation.

import requests
# Returns JSON file of today’s sunset time for DCA airport
response = requests.get('http://apps.tsa.dhs.gov/MyTSAWebService/GetEventInfo.ashx?eventtype=sunset&airportcode=DCA&output=json')
data = response.json()

library(jsonlite)
# Returns JSON file of today’s sunset time for DCA airport
data <- fromJSON('http://apps.tsa.dhs.gov/MyTSAWebService/GetEventInfo.ashx?eventtype=sunset&airportcode=DCA&output=json')