PyTransportNSWv2 2.0.2__tar.gz → 2.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PKG-INFO +1 -1
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/PKG-INFO +1 -1
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/TransportNSWv2/TransportNSWv2.py +21 -15
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/setup.py +1 -1
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/LICENSE +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/SOURCES.txt +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/TransportNSWv2.py +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/dependency_links.txt +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/requires.txt +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/top_level.txt +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/README.md +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/TransportNSWv2/__init__.py +0 -0
- {PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/setup.cfg +0 -0
@@ -269,7 +269,7 @@ class TransportNSWv2(object):
|
|
269
269
|
raise APIRateLimitExceeded("Error 'API rate limit exceeded' calling trip API for journey {name_origin} to {name_destination}")
|
270
270
|
|
271
271
|
else:
|
272
|
-
raise TripError(f"Error '{str(response.
|
272
|
+
raise TripError(f"Error '{str(response.status_code)}' calling trip API for journey {name_origin} to {name_destination}")
|
273
273
|
|
274
274
|
result = response.json()
|
275
275
|
|
@@ -452,14 +452,16 @@ class TransportNSWv2(object):
|
|
452
452
|
return None, None, None, None, None
|
453
453
|
|
454
454
|
for journey_index in range (start_journey_index, journey_count, 1):
|
455
|
-
|
455
|
+
journey = journeys[journey_index]
|
456
|
+
|
457
|
+
origin_leg = self._find_first_leg(journey['legs'], origin_transport_type, strict, route_filter)
|
456
458
|
|
457
459
|
if origin_leg is not None:
|
458
|
-
destination_leg = self._find_last_leg(
|
460
|
+
destination_leg = self._find_last_leg(journey['legs'], destination_transport_type, strict)
|
459
461
|
|
460
462
|
if origin_leg is not None and destination_leg is not None:
|
461
|
-
changes = self._find_changes(
|
462
|
-
return
|
463
|
+
changes = self._find_changes(journey['legs'], origin_leg, destination_leg)
|
464
|
+
return journey['legs'], journey_index + 1, origin_leg, destination_leg, changes
|
463
465
|
else:
|
464
466
|
return None, None, None, None, None
|
465
467
|
|
@@ -523,24 +525,28 @@ class TransportNSWv2(object):
|
|
523
525
|
|
524
526
|
|
525
527
|
def _find_changes(self, legs, origin_leg, destination_leg):
|
526
|
-
# Find out how often we have to change
|
528
|
+
# Find out how often we have to change. Immediately return 0 if the origin and destination legs are the same
|
529
|
+
if origin_leg == destination_leg:
|
530
|
+
return 0
|
531
|
+
|
532
|
+
# Count the changes, each time we hit new non-walking leg is considered to be a change
|
527
533
|
changes = 0
|
528
534
|
bInJourney = False
|
529
535
|
|
530
536
|
for leg in legs:
|
531
|
-
if leg == destination_leg:
|
532
|
-
# We've found the last leg (which oould be the same as the first leg), stop counting
|
533
|
-
return changes
|
534
|
-
|
535
537
|
if leg == origin_leg:
|
536
|
-
# We'
|
538
|
+
# We're in the journey so start capturing changes
|
537
539
|
bInJourney = True
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
540
|
+
|
541
|
+
elif bInJourney:
|
542
|
+
leg_class = leg['transportation']['product']['class']
|
543
|
+
if leg_class < 99:
|
544
|
+
if leg != destination_leg:
|
542
545
|
changes += 1
|
543
546
|
|
547
|
+
if leg == destination_leg:
|
548
|
+
return changes
|
549
|
+
|
544
550
|
# We should never get here!
|
545
551
|
return 999
|
546
552
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5
5
|
|
6
6
|
setuptools.setup(
|
7
7
|
name="PyTransportNSWv2",
|
8
|
-
version="2.0.
|
8
|
+
version="2.0.3",
|
9
9
|
author="andystewart999",
|
10
10
|
author_email="andy.stewart@live.com",
|
11
11
|
description="Get detailed per-trip transport information from TransportNSW",
|
File without changes
|
File without changes
|
{PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/TransportNSWv2.py
RENAMED
File without changes
|
{PyTransportNSWv2-2.0.2 → PyTransportNSWv2-2.0.3}/PyTransportNSWv2.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|