INNER CODE UNIT · Python
get_airport_info
ANG13T/skytrack · modules/airport_info.py:44
def get_airport_info(airport_ident, airport_name):
headers = {
'User-Agent': 'SKYTRACK: Aviation-based intelligence gathering tool'\
'Information at: https://github.com/ANG13T/skytrack'
}
if not os.path.exists(cache_path) or os.stat(cache_path).st_size == 0:
r = requests.get(
URL,
stream=True,
headers=headers)
if r.status_code == 200:
if not os.path.exists(os.path.dirname(cache_path)):
os.makedirs(os.path.dirname(cache_path))
with open(cache_path, 'wb') as f:
total_l = int(r.headers.get('content-length'))