Elfsong commited on
Commit
eb8c3f1
·
verified ·
1 Parent(s): 0f22030

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -23,7 +23,7 @@ wide_space_default()
23
 
24
  count = st_autorefresh(interval=30000)
25
 
26
- def get_all_stops():
27
  url = "https://nnextbus.nus.edu.sg/BusStops"
28
 
29
  payload = {}
@@ -117,8 +117,7 @@ def get_smrt_train_arrival(station_code):
117
 
118
  return trains
119
 
120
-
121
- # stops = get_all_stops()
122
  nus_bus_stops = [
123
  {
124
  "caption": "COM 3",
@@ -154,6 +153,7 @@ nus_bus_stops = [
154
  },
155
  ]
156
 
 
157
  public_bus_stops = [
158
  {
159
  'name': "Opp HMK",
@@ -165,7 +165,8 @@ public_bus_stops = [
165
  },
166
  ]
167
 
168
- public_mrt_station = [
 
169
  {
170
  'name': "KR MRT",
171
  'code': 'CKRG'
@@ -184,11 +185,14 @@ st.write(
184
  unsafe_allow_html=True,
185
  )
186
 
 
 
 
187
  # Layout
188
  coloumns = [2,1,1,1,1,1,1,1,1,1,1]
189
  number_of_coloumns = len(coloumns)
190
 
191
- # NUS Stops
192
  for stop_info in nus_bus_stops:
193
  shuttle_info = get_nus_bus_arrival(stop_info['name'])
194
 
@@ -248,8 +252,8 @@ for stop_info in public_bus_stops:
248
  for i, bus in enumerate(buses[:number_of_coloumns-1]):
249
  cols[i+1].metric(bus["type"], bus['service'], bus["eta"])
250
 
251
- # SMRT
252
- for station in public_mrt_station:
253
  smrt_data = get_smrt_train_arrival(station['code'])
254
  trains = list()
255
 
 
23
 
24
  count = st_autorefresh(interval=30000)
25
 
26
+ def get_all_nus_stops():
27
  url = "https://nnextbus.nus.edu.sg/BusStops"
28
 
29
  payload = {}
 
117
 
118
  return trains
119
 
120
+ # NUS Bus Stops
 
121
  nus_bus_stops = [
122
  {
123
  "caption": "COM 3",
 
153
  },
154
  ]
155
 
156
+ # Public Bus Stops
157
  public_bus_stops = [
158
  {
159
  'name': "Opp HMK",
 
165
  },
166
  ]
167
 
168
+ # MRT Stations
169
+ public_mrt_stations = [
170
  {
171
  'name': "KR MRT",
172
  'code': 'CKRG'
 
185
  unsafe_allow_html=True,
186
  )
187
 
188
+ # Acknowledgement
189
+ st.write("I would like to thank NUS [NextBus](https://nnextbus.nus.edu.sg), [LTA](https://datamall2.mytransport.sg), and [SMRT](https://trainarrivalweb.smrt.com.sg/) for providing data, albeit perhaps unintentionally. If you plan to use their data as well, please be considerate with your network traffic to avoid disrupting their services.")
190
+
191
  # Layout
192
  coloumns = [2,1,1,1,1,1,1,1,1,1,1]
193
  number_of_coloumns = len(coloumns)
194
 
195
+ # NUS Bus
196
  for stop_info in nus_bus_stops:
197
  shuttle_info = get_nus_bus_arrival(stop_info['name'])
198
 
 
252
  for i, bus in enumerate(buses[:number_of_coloumns-1]):
253
  cols[i+1].metric(bus["type"], bus['service'], bus["eta"])
254
 
255
+ # SMRT Train
256
+ for station in public_mrt_stations:
257
  smrt_data = get_smrt_train_arrival(station['code'])
258
  trains = list()
259