|
4 | 4 | """Queue-Times.com API Example"""
|
5 | 5 |
|
6 | 6 | import os
|
7 |
| -import time |
8 | 7 |
|
9 | 8 | import adafruit_connection_manager
|
10 | 9 | import wifi
|
@@ -55,34 +54,33 @@ def time_calc(input_time):
|
55 | 54 | try:
|
56 | 55 | with requests.get(url=QTIMES_SOURCE) as qtimes_response:
|
57 | 56 | qtimes_json = qtimes_response.json()
|
| 57 | + |
| 58 | + print(" | ✅ Queue-Times JSON\n") |
| 59 | + DEBUG_QTIMES = False |
| 60 | + if DEBUG_QTIMES: |
| 61 | + print("Full API GET URL: ", QTIMES_SOURCE) |
| 62 | + print(qtimes_json) |
| 63 | + |
| 64 | + # Poll Once and end script |
| 65 | + for land in qtimes_json["lands"]: |
| 66 | + qtimes_lands = str(land["name"]) |
| 67 | + print(f" | Land: {qtimes_lands}") |
| 68 | + |
| 69 | + # Loop through each ride in the land |
| 70 | + for ride in land["rides"]: |
| 71 | + qtimes_rides = str(ride["name"]) |
| 72 | + qtimes_queuetime = str(ride["wait_time"]) |
| 73 | + qtimes_isopen = str(ride["is_open"]) |
| 74 | + |
| 75 | + print(f" | | Ride: {qtimes_rides}") |
| 76 | + print(f" | | Queue Time: {qtimes_queuetime} Minutes") |
| 77 | + if qtimes_isopen == "False": |
| 78 | + print(" | | Status: Closed\n") |
| 79 | + elif qtimes_isopen == "True": |
| 80 | + print(" | | Status: Open\n") |
| 81 | + else: |
| 82 | + print(" | | Status: Unknown\n") |
| 83 | + |
| 84 | + |
58 | 85 | except ConnectionError as e:
|
59 | 86 | print("Connection Error:", e)
|
60 |
| -print(" | ✅ Queue-Times JSON\n") |
61 |
| -DEBUG_QTIMES = False |
62 |
| -if DEBUG_QTIMES: |
63 |
| - print("Full API GET URL: ", QTIMES_SOURCE) |
64 |
| - print(qtimes_json) |
65 |
| -qtimes_response.close() |
66 |
| - |
67 |
| -# Poll Once and end script |
68 |
| -for land in qtimes_json["lands"]: |
69 |
| - qtimes_lands = str(land["name"]) |
70 |
| - print(f" | Land: {qtimes_lands}") |
71 |
| - time.sleep(1) |
72 |
| - |
73 |
| - # Loop through each ride in the land |
74 |
| - for ride in land["rides"]: |
75 |
| - qtimes_rides = str(ride["name"]) |
76 |
| - qtimes_queuetime = str(ride["wait_time"]) |
77 |
| - qtimes_isopen = str(ride["is_open"]) |
78 |
| - |
79 |
| - print(f" | | Ride: {qtimes_rides}") |
80 |
| - print(f" | | Queue Time: {qtimes_queuetime} Minutes") |
81 |
| - if qtimes_isopen == "False": |
82 |
| - print(" | | Status: Closed\n") |
83 |
| - elif qtimes_isopen == "True": |
84 |
| - print(" | | Status: Open\n") |
85 |
| - else: |
86 |
| - print(" | | Status: Unknown\n") |
87 |
| - |
88 |
| - time.sleep(1) # delay between list items |
0 commit comments