Skip to content
Permalink
3ea1c562d6
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
20 lines (13 sloc) 398 Bytes
import requests
from pprint import pprint
def get_plane_data(icao_code):
base_url = "https://api.airplanes.live/v2/"
api_url = "icao/"
url = f"{base_url}{api_url}{icao_code}"
# Make the request
req = requests.get(url)
jsondata = req.json() # Return JSON data from response
flight = jsondata["ac"][0]
pprint(flight)
return flight
get_plane_data("4BAA84")