Skip to content

Commit e937790

Browse files
authored
Update Airline_flights_identification.py
1 parent 64c71a1 commit e937790

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Phase2/Airline_flights_identification.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,47 @@
1212

1313
# Map tool
1414
import folium
15+
16+
17+
flights = fr_api.get_flights("IRM")
18+
19+
flight = flights[0]
20+
flight_details = fr_api.get_flight_details(flight)
21+
22+
23+
aircraft = flight_details['aircraft']
24+
airline = flight_details['airline']
25+
26+
if flight_details['airport']['origin'] != None:
27+
origin = flight_details['airport']['origin']['name']
28+
else:
29+
origin = None
30+
31+
if flight_details['airport']['destination'] != None:
32+
destination = flight_details['airport']['destination']['name']
33+
destination_icao = flight_details['airport']['destination']['code']['icao']
34+
else:
35+
destination = None
36+
37+
38+
response = flight_details['aircraft']['images']['large']
39+
for r in response:
40+
curr_response = requests.get(r['src'])
41+
img2 = Image.open(BytesIO(curr_response.content))
42+
43+
# Show the loaded image
44+
#img2.show()
45+
46+
plt.imshow(img2,cmap='gray')
47+
plt.show()
48+
49+
50+
if airline != None:
51+
print(aircraft['model']['text'], ": ", airline['name'], "/", airline['code']['icao'])
52+
print("{} ----> {}".format(origin, destination))
53+
54+
55+
airport = fr_api.get_airport(destination_icao)
56+
distance = flight.get_distance_from(airport)
57+
58+
print("{}km".format(distance))

0 commit comments

Comments
 (0)