Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,9 +65,9 @@ def get_vehicle_locations_and_occupancy(vehicle_numbers):
|
|
| 65 |
return results
|
| 66 |
|
| 67 |
def get_vehicle_destinations(route, stopcall):
|
|
|
|
| 68 |
|
| 69 |
url = f'https://www.transsee.ca/predict?s=ttc.{route}.{stopcall}'
|
| 70 |
-
print(f"DEBUG: Fetching vehicle destinations for route: {route}, stopcall: {stopcall}, url: {url}", file=sys.stderr)
|
| 71 |
headers = {
|
| 72 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
|
| 73 |
'Referer': 'https://www.transsee.ca/',
|
|
@@ -90,7 +90,7 @@ def get_vehicle_destinations(route, stopcall):
|
|
| 90 |
vehicle_info = {}
|
| 91 |
|
| 92 |
# Use a regex to find the <p> tag with an id that starts with route and stopcall
|
| 93 |
-
pattern = re.compile(rf'^{route}_{stopcall}_
|
| 94 |
dest_par = soup.find('p', id=pattern)
|
| 95 |
|
| 96 |
if dest_par:
|
|
|
|
| 65 |
return results
|
| 66 |
|
| 67 |
def get_vehicle_destinations(route, stopcall):
|
| 68 |
+
print(f"DEBUG: Fetching vehicle destinations for route: {route}, stopcall: {stopcall}")
|
| 69 |
|
| 70 |
url = f'https://www.transsee.ca/predict?s=ttc.{route}.{stopcall}'
|
|
|
|
| 71 |
headers = {
|
| 72 |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',
|
| 73 |
'Referer': 'https://www.transsee.ca/',
|
|
|
|
| 90 |
vehicle_info = {}
|
| 91 |
|
| 92 |
# Use a regex to find the <p> tag with an id that starts with route and stopcall
|
| 93 |
+
pattern = re.compile(rf'^{route}_{stopcall}_?\d*$')
|
| 94 |
dest_par = soup.find('p', id=pattern)
|
| 95 |
|
| 96 |
if dest_par:
|