PyTransportNSWv2 0.8.3__tar.gz → 0.8.4__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.
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyTransportNSWv2
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: Get detailed per-trip transport information from TransportNSW
5
5
  Home-page: https://github.com/andystewart999/TransportNSW
6
6
  Author: andystewart999
7
+ Author-email: andy.stewart@live.com
7
8
  License: UNKNOWN
8
9
  Description: # TransportNSWv2
9
10
  Python lib to access Transport NSW information.
@@ -147,7 +148,7 @@ Description: # TransportNSWv2
147
148
  Also note that the 'transport_type' filter, if present, only makes sure that at least **one** leg of the journey includes that transport type unless ```strict_transport_type``` is True, in which case the **first** leg must be of the requested type to be returned.
148
149
 
149
150
  ### Rate limits ###
150
- By default the TransportNSW API allows each API key to make 60,000 calls in a day and up to 5 calls per second. Usually this wouldn't be an issue but due if you're requesting real-time location data for buses, because I haven't found an elegant way to map the bus route to the correct API URL (and there are about 14) it's brute-forcing it by iterating through ALL the possible URLs until it finds the appropriate journey or it runs out of URLs. From version 0.8.2 I've added in a 0.5 second delay between loops until I can find a better approach.
151
+ By default the TransportNSW API allows each API key to make 60,000 calls in a day and up to 5 calls per second. Usually this wouldn't be an issue but if you're requesting real-time location data for buses, because I haven't found an elegant way to map the bus route to the correct API URL (and there are about 14) it's brute-forcing it by iterating through ALL the possible URLs until it finds the appropriate journey or it runs out of URLs. From version 0.8.2 I've added in a 0.5 second delay between loops until I can find a better approach.
151
152
 
152
153
  ## Thank you
153
154
  Thank you Dav0815 for your TransportNSW library that the vast majority of this fork is based on. I couldn't have done it without you!
@@ -1,9 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyTransportNSWv2
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: Get detailed per-trip transport information from TransportNSW
5
5
  Home-page: https://github.com/andystewart999/TransportNSW
6
6
  Author: andystewart999
7
+ Author-email: andy.stewart@live.com
7
8
  License: UNKNOWN
8
9
  Description: # TransportNSWv2
9
10
  Python lib to access Transport NSW information.
@@ -147,7 +148,7 @@ Description: # TransportNSWv2
147
148
  Also note that the 'transport_type' filter, if present, only makes sure that at least **one** leg of the journey includes that transport type unless ```strict_transport_type``` is True, in which case the **first** leg must be of the requested type to be returned.
148
149
 
149
150
  ### Rate limits ###
150
- By default the TransportNSW API allows each API key to make 60,000 calls in a day and up to 5 calls per second. Usually this wouldn't be an issue but due if you're requesting real-time location data for buses, because I haven't found an elegant way to map the bus route to the correct API URL (and there are about 14) it's brute-forcing it by iterating through ALL the possible URLs until it finds the appropriate journey or it runs out of URLs. From version 0.8.2 I've added in a 0.5 second delay between loops until I can find a better approach.
151
+ By default the TransportNSW API allows each API key to make 60,000 calls in a day and up to 5 calls per second. Usually this wouldn't be an issue but if you're requesting real-time location data for buses, because I haven't found an elegant way to map the bus route to the correct API URL (and there are about 14) it's brute-forcing it by iterating through ALL the possible URLs until it finds the appropriate journey or it runs out of URLs. From version 0.8.2 I've added in a 0.5 second delay between loops until I can find a better approach.
151
152
 
152
153
  ## Thank you
153
154
  Thank you Dav0815 for your TransportNSW library that the vast majority of this fork is based on. I couldn't have done it without you!
@@ -140,7 +140,7 @@ Note also that the origin and destination details are just that - information ab
140
140
  Also note that the 'transport_type' filter, if present, only makes sure that at least **one** leg of the journey includes that transport type unless ```strict_transport_type``` is True, in which case the **first** leg must be of the requested type to be returned.
141
141
 
142
142
  ### Rate limits ###
143
- By default the TransportNSW API allows each API key to make 60,000 calls in a day and up to 5 calls per second. Usually this wouldn't be an issue but due if you're requesting real-time location data for buses, because I haven't found an elegant way to map the bus route to the correct API URL (and there are about 14) it's brute-forcing it by iterating through ALL the possible URLs until it finds the appropriate journey or it runs out of URLs. From version 0.8.2 I've added in a 0.5 second delay between loops until I can find a better approach.
143
+ By default the TransportNSW API allows each API key to make 60,000 calls in a day and up to 5 calls per second. Usually this wouldn't be an issue but if you're requesting real-time location data for buses, because I haven't found an elegant way to map the bus route to the correct API URL (and there are about 14) it's brute-forcing it by iterating through ALL the possible URLs until it finds the appropriate journey or it runs out of URLs. From version 0.8.2 I've added in a 0.5 second delay between loops until I can find a better approach.
144
144
 
145
145
  ## Thank you
146
146
  Thank you Dav0815 for your TransportNSW library that the vast majority of this fork is based on. I couldn't have done it without you!
@@ -121,7 +121,11 @@ class TransportNSWv2(object):
121
121
 
122
122
  # If we get bad status code, log error and return with n/a or an empty string
123
123
  if response.status_code != 200:
124
- logger.error("Error " + str(response.status_code) + " calling /v1/tp/stop_finder API; check api key")
124
+ if response.status_code == 429:
125
+ logger.error("Error " + str(response.status_code) + " calling /v1/tp/stop_finder API; rate limit exceeded")
126
+ else:
127
+ logger.error("Error " + str(response.status_code) + " calling /v1/tp/stop_finder API; check api key")
128
+
125
129
  return None
126
130
 
127
131
  # Parse the result as a JSON object
@@ -190,7 +194,6 @@ class TransportNSWv2(object):
190
194
  if ((journey is None) or (journey['legs']) is None):
191
195
  pass
192
196
  else:
193
- print (journey)
194
197
  legs = journey['legs']
195
198
  first_leg = self.find_first_leg(legs, transport_type, strict_transport_type, route_filter)
196
199
 
@@ -213,8 +216,6 @@ class TransportNSWv2(object):
213
216
  t2 = datetime.strptime(origin_departure_time_planned, fmt).timestamp()
214
217
  delay = int((t1-t2) / 60)
215
218
 
216
- #print (origin_departure_time - origin_departure_time_planned)
217
-
218
219
  # How long until it leaves?
219
220
  due = self.get_due(datetime.strptime(origin_departure_time, fmt))
220
221
 
@@ -445,17 +446,13 @@ class TransportNSWv2(object):
445
446
  leg_count = len(legs)
446
447
  found_alerts = []
447
448
  priority_minimum = self.get_alert_priority(priority_filter)
448
- print ("priority_minimum = " + str(priority_minimum))
449
449
  alert_list = alert_type.split("|")
450
450
 
451
451
  for leg_index in range (0, leg_count, 1):
452
452
  current_leg = legs[leg_index]
453
453
  if 'infos' in current_leg:
454
- print ("Found 'infos' in leg")
455
- print (current_leg['infos'])
456
454
  alerts = current_leg['infos']
457
455
  for alert in alerts:
458
- print ("Found alert")
459
456
  if (self.get_alert_priority(alert['priority'])) >= priority_minimum:
460
457
  if (alert_type == 'all') or (alert['type'].lower() in alert_list):
461
458
  found_alerts.append (alert)
@@ -471,14 +468,7 @@ class TransportNSWv2(object):
471
468
  current_leg = legs[leg_index]
472
469
  leg_class = current_leg['transportation']['product']['class']
473
470
  if 'hints' in current_leg:
474
- #print ("")
475
- #print ("Found hint(s) for leg " + str(leg_index) )
476
471
  hints = current_leg['hints']
477
- #for hint in hints:
478
- #print ("Hint:")
479
- #print (hint)
480
- #print (" ")
481
-
482
472
 
483
473
 
484
474
  def get_mode(self, iconId):
@@ -5,8 +5,9 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="PyTransportNSWv2",
8
- version="0.8.3",
8
+ version="0.8.4",
9
9
  author="andystewart999",
10
+ author_email="andy.stewart@live.com",
10
11
  description="Get detailed per-trip transport information from TransportNSW",
11
12
  long_description=long_description,
12
13
  long_description_content_type="text/markdown",