travelynx does not render newlines in comments

This commit is contained in:
Franzi 2024-01-05 10:42:48 +01:00
parent 8b1046d238
commit aedb702c38
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -66,9 +66,9 @@ for checkin in sorted(checkins, key=lambda c: c["createdAt"]):
train_type = checkin["train"]["lineName"].split(" ")[0] train_type = checkin["train"]["lineName"].split(" ")[0]
comment = [f"Import from Traewelling, ID {checkin['id']}"] comment = [f"Import from Traewelling, ID {checkin['id']}"]
if checkin["body"]: if checkin["body"]:
comment.extend(["", checkin["body"]]) comment.append(checkin["body"])
if checkin["event"]: if checkin["event"]:
comment.extend(["", checkin["event"]["name"], checkin["event"]["url"]]) comment.extend([checkin["event"]["name"], checkin["event"]["url"]])
travelynx_data = { travelynx_data = {
"token": TRAVELYNX_API_TOKEN, "token": TRAVELYNX_API_TOKEN,
"dryRun": False, "dryRun": False,
@ -114,7 +114,7 @@ for checkin in sorted(checkins, key=lambda c: c["createdAt"]):
else None, else None,
}, },
# "intermediateStops": [], # "intermediateStops": [],
"comment": "\n".join(comment), "comment": " - ".join(comment),
} }
l.debug(json.dumps(travelynx_data)) l.debug(json.dumps(travelynx_data))
r = s.post( r = s.post(