RATP: Use monitoring from IDFM

This commit is contained in:
nemunaire 2022-12-30 20:36:05 +01:00
parent 9db00b8cd8
commit 8f227ff099

View File

@ -92,7 +92,7 @@ class IDFMAPI:
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:
with urllib.request.urlopen(req) as f:
with open(cache_file, 'wb') as fd:
@ -167,12 +167,6 @@ class IDFMAPI:
if l["id"] == "line:IDFM:" + IDFMAPI.lines[mode][line]:
for d in l["disruptions"]:
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