Comments (10)
Overall i am a bit skeptical of merging this. If pyhafas exists, why not use that directly? Because the pyhafas API is too inconvenient/non-intuitive or what is your motivation? Happy to hear your thoughts on this to understand what the motivation is :)
- True, it could be done completely separately. For me, this was the easiest way to fix the delay issue and to fix that Home Assistant does not want any scraping anymore. Additionally, I think, it is more stable way over HAFAS and because it is the same data, I can see no drawback. But not sure, wether I got the complete thing.
As the author of hafas-client
, which pyhafas has been ported from, I can attest the same: HAFAS is indeed a very stable API because it is hard for both HaCon and especially their customers to change it without breaking all those mobile apps out there.
Two drawbacks come to my mind though: While the HAFAS mgate.exe
APIs are publicly available, without (reasonable) protection, they are not intended for usage by "random people on the internet", i.e. people outside of specific contracts allowing the API access. This has two consequences:
- There might be legal problems with accessing the HAFAS API, given that it has some (arguably insignificant) protection mechanisms in place.
- They might be able to block
schiene
(and/or the Home Assistant instances using on it) more easily than with web scraping.
Still I think that using the HAFAS API will likely never become a problem; Rather, it should make those tools based on it more stable than scraping-based ones. Both the MagicMirror public transport module as well as the ioBroker adapter has used it for a while now. cc @KristjanESPERANTO @gaudes
from schiene.
@Kurisudes i donβt think this should get merged, even if your work really is great, good and I also understand the intention about it.
I think hafas should stay separated. And for Homeassistant a complete new integration should be done.
There is already a pull request which would implement exactly your feature:
home-assistant/core#78839
Unfortunately it did not get merged yet.
from schiene.
@FaserF Yes im also leaning towards keeping the code of schiene
based on web scraping, the way it is.
There are HAFAS-based projects out there, free to use for those who need it. I consider this project to be more off a backup/alternative if the official APIs ever get blocked and/or reduced.
from schiene.
related: #1
from schiene.
I have a solution for this now running.
But I do not know what the HTML link in detail is for. I don't know what I should do with it.
Also the price is supported in HAFAS but not supported in pyhafas.
If you agree to take this change, then I will also do a pull request for pyhafas as well.
from schiene.
@Kurisudes Hello and thank you for the work/research done.
Some things:
-
I don't know how feature-complete HAFAS - more specifically the pyhafas lib - is. It seems it supports delays, possibly also prices(?). Also not sure what sort of dependencies it has, i will look into it over the next few days.
-
I need to look at how similar the data is that HAFAS gives versus Bahn.de as i don't want to have major breaks in icompatibility with existing code.
-
Overall i am a bit skeptical of merging this. If pyhafas exists, why not use that directly? Because the pyhafas API is too inconvenient/non-intuitive or what is your motivation? Happy to hear your thoughts on this to understand what the motivation is :)
Again thank you and i will be looking into it, very busy right now and limited in time so please apologize any delay.
from schiene.
@kennell
Thanks for you quick answer.
- I added delays to the program already. As far as I tested, it is working perfectly and better as before because before delay was only showing for the first connection. Prices are supported with HAFAS but pyhafas does not support it. I think, I can change it in pyhafas. If you agree to merge my pull request, then I will do a pull request to pyhafas for that topic.
- HAFAS is the base for all searches on bahn.de as far as I know. So the data should be the same. Even in the ticket office, they are using HAFAS.
- True, it could be done completely separately. For me, this was the easiest way to fix the delay issue and to fix that Home Assistant does not want any scraping anymore. Additionally, I think, it is more stable way over HAFAS and because it is the same data, I can see no drawback. But not sure, wether I got the complete thing.
from schiene.
And if you just want to get the existing code working again with HA, you could just use my custom integration if you want:
https://github.com/FaserF/ha-deutschebahn
from schiene.
I understand your argument.
It is a little disappointing for me but okay.
from schiene.
I think hafas should stay separated. And for Homeassistant a complete new integration should be done. There is already a pull request which would implement exactly your feature: home-assistant/core#78839
Unfortunately it did not get merged yet.
Thanks, I could not find this pull request but this looks promising. Unfortunately, it is already very old.
from schiene.
Related Issues (20)
- "delay" not working HOT 5
- >AttributeError: 'NoneType' object has no attribute 'find'< on certain connections HOT 15
- There is a Bahn api now HOT 8
- HTML Code changed? HOT 1
- Problem with Wolfbusch Station HOT 2
- "self.data.update & self.only_direct" in update HOT 2
- Duration not accurate if >24 hours HOT 1
- Better Alternative HOT 1
- Is there a limit to requests / seconds? HOT 2
- Parallel? HOT 1
- Hamburg-Eidelstedt not working HOT 2
- schiene crashes HOT 2
- Not getting the next train correctly HOT 3
- Help with use HOT 1
- TypeError: unsupported operand type HOT 2
- Bahn declares cancelled train wrong?
- Canceled connection is reported as 'ontime'
- Requirement "lxml" missing HOT 1
- Schiene fails to convert price to float HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from schiene.