File tree 3 files changed +11
-2
lines changed
3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 56
56
osn_header = {"Authorization" : "Basic " + str (base64cred )}
57
57
OPENSKY_SOURCE = "https://opensky-network.org/api/states/all?" + "icao24=" + transponder
58
58
59
+
59
60
# Converts seconds to human readable minutes/hours/days
60
61
def time_calc (input_time ): # input_time in seconds
61
62
if input_time < 60 :
@@ -72,6 +73,7 @@ def time_calc(input_time): # input_time in seconds
72
73
time_output = f"{ sleep_int :.1f} days"
73
74
return time_output
74
75
76
+
75
77
def _format_datetime (datetime ):
76
78
return "{:02}/{:02}/{} {:02}:{:02}:{:02}" .format (
77
79
datetime .tm_mon ,
@@ -82,6 +84,7 @@ def _format_datetime(datetime):
82
84
datetime .tm_sec ,
83
85
)
84
86
87
+
85
88
# Connect to Wi-Fi
86
89
print ("\n ===============================" )
87
90
print ("Connecting to WiFi..." )
@@ -105,7 +108,7 @@ def _format_datetime(datetime):
105
108
106
109
print ("\n Attempting to GET OpenSky-Network Data!" )
107
110
opensky_response = request .get (url = OPENSKY_SOURCE , headers = osn_header ).json ()
108
-
111
+
109
112
# Print Full JSON to Serial (doesn't show credentials)
110
113
debug_response = False # Set True to see full response
111
114
if debug_response :
Original file line number Diff line number Diff line change 70
70
+ lonmax
71
71
)
72
72
73
+
73
74
# Converts seconds to human readable minutes/hours/days
74
75
def time_calc (input_time ): # input_time in seconds
75
76
if input_time < 60 :
@@ -86,6 +87,7 @@ def time_calc(input_time): # input_time in seconds
86
87
time_output = f"{ sleep_int :.1f} days"
87
88
return time_output
88
89
90
+
89
91
def _format_datetime (datetime ):
90
92
return "{:02}/{:02}/{} {:02}:{:02}:{:02}" .format (
91
93
datetime .tm_mon ,
@@ -96,6 +98,7 @@ def _format_datetime(datetime):
96
98
datetime .tm_sec ,
97
99
)
98
100
101
+
99
102
# Connect to Wi-Fi
100
103
print ("\n ===============================" )
101
104
print ("Connecting to WiFi..." )
@@ -119,7 +122,7 @@ def _format_datetime(datetime):
119
122
120
123
print ("\n Attempting to GET OpenSky-Network Data!" )
121
124
opensky_response = request .get (url = OPENSKY_SOURCE , headers = osn_header ).json ()
122
-
125
+
123
126
# Print Full JSON to Serial (doesn't show credentials)
124
127
debug_response = False # Set True to see full response
125
128
if debug_response :
Original file line number Diff line number Diff line change 34
34
# example https://opensky-network.org/api/states/all?icao24=a808c5
35
35
OPENSKY_SOURCE = "https://opensky-network.org/api/states/all?" + "icao24=" + transponder
36
36
37
+
37
38
# Converts seconds to human readable minutes/hours/days
38
39
def time_calc (input_time ): # input_time in seconds
39
40
if input_time < 60 :
@@ -50,6 +51,7 @@ def time_calc(input_time): # input_time in seconds
50
51
time_output = f"{ sleep_int :.1f} days"
51
52
return time_output
52
53
54
+
53
55
def _format_datetime (datetime ):
54
56
return "{:02}/{:02}/{} {:02}:{:02}:{:02}" .format (
55
57
datetime .tm_mon ,
@@ -60,6 +62,7 @@ def _format_datetime(datetime):
60
62
datetime .tm_sec ,
61
63
)
62
64
65
+
63
66
# Connect to Wi-Fi
64
67
print ("\n ===============================" )
65
68
print ("Connecting to WiFi..." )
You can’t perform that action at this time.
0 commit comments