RATP: Use monitoring from IDFM
This commit is contained in:
parent
9db00b8cd8
commit
8f227ff099
@ -92,7 +92,7 @@ class IDFMAPI:
|
|||||||
|
|
||||||
cache_file = self._cached_file % ("schedule-" + mode + "-" + line + "-" + hashlib.md5((mode + line + station + way).encode()).hexdigest())
|
cache_file = self._cached_file % ("schedule-" + mode + "-" + line + "-" + hashlib.md5((mode + line + station + way).encode()).hexdigest())
|
||||||
|
|
||||||
req = urllib.request.Request("https://ratp.p0m.fr/api/schedules/%s/%s/%s/%s" % (mode, line, station, way))
|
req = urllib.request.Request(self.baseurl + "/stop-monitoring?MonitoringRef=STIF:StopPoint:Q:" + IDFMAPI.stops[mode][line][station] + ":", headers={'apikey': self.apikey})
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(req) as f:
|
with urllib.request.urlopen(req) as f:
|
||||||
with open(cache_file, 'wb') as fd:
|
with open(cache_file, 'wb') as fd:
|
||||||
@ -167,12 +167,6 @@ class IDFMAPI:
|
|||||||
if l["id"] == "line:IDFM:" + IDFMAPI.lines[mode][line]:
|
if l["id"] == "line:IDFM:" + IDFMAPI.lines[mode][line]:
|
||||||
for d in l["disruptions"]:
|
for d in l["disruptions"]:
|
||||||
yield IDFMAPI.fromIVtoPRIM(d)
|
yield IDFMAPI.fromIVtoPRIM(d)
|
||||||
else:
|
|
||||||
for d in l["disruptions"]:
|
|
||||||
for n in d["networks"]:
|
|
||||||
for l in n["lines"]:
|
|
||||||
if l["id"] == "line:IDFM:" + line:
|
|
||||||
yield IDFMAPI.fromIVtoPRIM(d)
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user