Messages isn’t a valid keyword (anymore?) #2
Labels
No Label
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Reference: profitroll/PythonRMV#2
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Whenever I call any method (for example journey_detail()), it throws an error:
File /usr/lib/python3.11/site-packages/pyrmv-0.3.4-py3.11.egg/pyrmv/classes/Journey.py:17 in init
for message in data["Messages"]["Message"]:
KeyError: 'Messages'
I looked into it and I can’t be sure but it seems like they renamed it to "Notes" and "Note" instead of "Messages" and "Message".
"Notes"
doesn't seem to be a replacement, it's an addition. It seems like"Messages"
became optional at this point. RMV does not disclose response models anymore and did not update their HAFAS installation documentation, so I'll try to guess how to work around this problem...Please update your
pyrmv
to0.3.5
using PyPi or Gitea's package index and review if the problem is gone.I assume that RMV did more changes to their API than those found at the moment, but without their HAFAS docs it's hard to quickly figure out which exactly.
Okay, I checked everything again. It is as I feared; they changed the way you have to specify the id for a journey. It used to be the JourneyDetailRef found in departures, however apparently that string isn’t supported anymore, at least I haven’t found any example where it yields a result. A friend of mine with whom I tried to understand the API yesterday found a call that works by random chance:
https://www.rmv.de/hapi/journeyDetail?accessId=[yourKey]&format=json&id=1|4166|2|80|18112023
We have no idea why this works or why it yields the data that it does but at least it’s not an error. More investigation would have to be done to figure out the new format.
It’s also possible that this isn’t the case and the JourneyDetailRef still works but we tried for three hours yesterday without any success.
True. Gives an error with a random chance.
Moreover, some of my projects relying on pyrmv started giving timeouts and connection resets as well. This is even more terrifying, because I'm not pushing the API or anything, so those are not retelims.
I have requested a new API key. Last time RMV also sent their HAFAS instance docs alongside the API key in email. Hoping for the best.
This API client also needs a rework someday, because it doesn't use asyncio yet and is not scalable at all. Going to take some time to refactor and maybe upgrade pyrmv at some point, yet this situation with API endpoint seems to be a nice call for it, lol.
I have the newest HAFAS docs from RMV (well, they sent them two days ago, but I don’t think anything has changed in the meantime) and there’s no info about the journey id situation. It’s definitely not a rate-limit issue and you probably won’t need the new API key because the old one should work just fine. Their API is documented really poorly in general and I think this might be a situation where you’d need to experiment a lot with trial-and-error how the id is actually supposed to be sent.
Hm. The last version I have seen from them was Server v2.22.1 (2021-11-09). IDs they used before were already marked as deprecated, yet new ones were unsupported at a time.
Anyway, project structure itself needs to be changed quite a lot, so I'm going to start with that and try to investigate the new behavior on the fly.
Their developer support deteriorated quite a bit after DDoS attacks lately, so I'm not expecting much from this adventure at this point. But I'll give it a shot.
I just sent you the latest HAFAS docs on Telegram.
Where did you get that ID from?
I have only seen this kind of JourneyRef in the HAFAS docs. RMV kinda accepts this format, yet does not output it anywhere. Even their
rmv.de/hapi/latest
uses old Refs.Yeah, exactly. We only stumbled upon this by accident. We went through the HAFAS docs I sent you and saw this ID format whereupon we started trying to understand the format and then just randomly typed in numbers and at one point this one by accident worked.
So I used the ID you found as a reference to break it down.
1|4166|2|80|18112023
corresponds to2|#VN#1#ST#1700765441#PI#0#ZI#4166#TA#2#DA#181123#1S#9994454#1T#802#LS#9994450#LT#807#PU#80#RT#1#CA#DRT#ZE#433.1#ZB# 433.1#PC#9#FR#9994454#FT#802#TO#9994450#TT#807#
My conclusion is:
I will be able to make a conversion function for it, that's not that hard, actually. But holy crap this looks so unreliable and will definitely break in the future...
That's why I'll alter the "higher-level" interface, but won't touch the raw functions.
Released as v0.4.0-rc.1 (pyrmv 0.4.0rc1 on PyPi).
Please, review this version and report if the problem with the refs persists.
Now the departure board isn’t working.
Released as v0.4.0-rc.2 (pyrmv 0.4.0rc2 on PyPi).
Please, review this version and all the breaking changes and report if the problem persists.