PyTransportNSWv2 2.0.5__tar.gz → 2.0.7__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.5 → PyTransportNSWv2-2.0.7}/PKG-INFO +1 -1
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/PyTransportNSWv2.egg-info/PKG-INFO +1 -1
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/TransportNSWv2/TransportNSWv2.py +16 -15
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/setup.py +1 -1
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/LICENSE +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/PyTransportNSWv2.egg-info/SOURCES.txt +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/PyTransportNSWv2.egg-info/TransportNSWv2.py +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/PyTransportNSWv2.egg-info/dependency_links.txt +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/PyTransportNSWv2.egg-info/requires.txt +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/PyTransportNSWv2.egg-info/top_level.txt +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/README.md +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/TransportNSWv2/__init__.py +0 -0
- {PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/setup.cfg +0 -0
@@ -15,6 +15,10 @@ import time
|
|
15
15
|
# Global API variable
|
16
16
|
api_calls = 0
|
17
17
|
|
18
|
+
def reset_api_counter():
|
19
|
+
global api_calls
|
20
|
+
api_calls = 0
|
21
|
+
|
18
22
|
def increment_api_counter(source):
|
19
23
|
global api_calls
|
20
24
|
api_calls += 1
|
@@ -115,6 +119,7 @@ class TransportNSWv2(object):
|
|
115
119
|
stop_list = []
|
116
120
|
skip_api_calls = False
|
117
121
|
|
122
|
+
|
118
123
|
try:
|
119
124
|
for stop in stops:
|
120
125
|
url = \
|
@@ -200,7 +205,7 @@ class TransportNSWv2(object):
|
|
200
205
|
|
201
206
|
"""Get the latest data from Transport NSW."""
|
202
207
|
fmt = '%Y-%m-%dT%H:%M:%SZ'
|
203
|
-
|
208
|
+
reset_api_counter()
|
204
209
|
|
205
210
|
route_filter = route_filter.lower()
|
206
211
|
include_alerts = include_alerts.lower()
|
@@ -532,7 +537,7 @@ class TransportNSWv2(object):
|
|
532
537
|
# Find out how often we have to change. Immediately return 0 if the origin and destination legs are the same
|
533
538
|
changes_list = []
|
534
539
|
if origin_leg == destination_leg:
|
535
|
-
return 0,
|
540
|
+
return 0, changes_list
|
536
541
|
|
537
542
|
# Count the changes, each time we hit new non-walking leg is considered to be a change
|
538
543
|
changes = 0
|
@@ -551,25 +556,21 @@ class TransportNSWv2(object):
|
|
551
556
|
elif bInJourney:
|
552
557
|
leg_class = leg['transportation']['product']['class']
|
553
558
|
if leg_class < 99:
|
554
|
-
|
555
|
-
changes += 1
|
559
|
+
changes += 1
|
556
560
|
|
557
|
-
|
558
|
-
|
559
|
-
|
561
|
+
# Also capture the origin and destination as a change, unless it's the same platform or stop as the last one
|
562
|
+
new_change_origin = leg['origin']['disassembledName']
|
563
|
+
new_change_destination = leg['destination']['disassembledName']
|
560
564
|
|
561
|
-
|
562
|
-
|
563
|
-
changes_list.append(new_change_destination)
|
565
|
+
if new_change_origin != last_change:
|
566
|
+
changes_list.append(new_change_origin)
|
564
567
|
|
568
|
+
if leg != destination_leg:
|
569
|
+
changes_list.append(new_change_destination)
|
565
570
|
last_change = new_change_destination
|
566
571
|
|
567
572
|
if leg == destination_leg:
|
568
|
-
#
|
569
|
-
new_change_origin = leg['origin']['disassembledName']
|
570
|
-
if new_change_origin != last_change:
|
571
|
-
changes_list.append(new_change_origin)
|
572
|
-
|
573
|
+
# We've finished looking for changes
|
573
574
|
return changes, changes_list
|
574
575
|
|
575
576
|
# We should never get here!
|
@@ -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.7",
|
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.5 → PyTransportNSWv2-2.0.7}/PyTransportNSWv2.egg-info/TransportNSWv2.py
RENAMED
File without changes
|
{PyTransportNSWv2-2.0.5 → PyTransportNSWv2-2.0.7}/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
|