Skip to content

Commit

Permalink
Remove trains from the api response
Browse files Browse the repository at this point in the history
Remove trains from the API response when the destination isn't found in the calling points. Is this a temporary fix? Why is the API returning wrong info?
  • Loading branch information
plutomedia987 committed Dec 19, 2024
1 parent 27f3d67 commit 6d70905
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions custom_components/nationalrailuk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,6 @@ def process_data(self, json_message_in):
############################################################
# Assign outputs
############################################################
if otherEnd:
train["otherEnd"] = otherEnd

train["scheduled"] = times["sheduled"]
train["expected"] = times["estimated"]
train["origin"] = service["origin"]["location"][0]["locationName"]
Expand All @@ -343,7 +340,9 @@ def process_data(self, json_message_in):
train["length"] = service["length"]
train["callingPoints"] = callingPoints

status["trains"].append(train)
if otherEnd:
train["otherEnd"] = otherEnd
status["trains"].append(train)

# with open("output_test.txt", "w") as convert_file:
# convert_file.write(str(status["trains"]))
Expand Down

0 comments on commit 6d70905

Please sign in to comment.