Comments (7)
Good one. Currently it catches the error from the NS XML API and prints "Error in trips: Geen geldige 'fromStation' opgegeven", returning None (as the input is 'faulty'), but I guess an empty list would work just as well. Going to change that now and push a new version.
Thanks!
from ns-api.
The input is valid in this case, meaning that the fromStation is in the list of stations given by nsapi.
Your fix does not resolve the problem. 'error' in obj
is False so it moves on to for trip in obj['ReisMogelijkheden']['ReisMogelijkheid']
and then raises a TypeError exception. That is at least what happens for me.
I am fine with None or empty list as return from get_trips. Just not a TypeError exception.
from ns-api.
Oh my bad, I copied your example and there's "Utrecht Central" in there (mind the single 'a'), so I got a different error. Apparantly I need more coffee, as your issue is with something else entirely. Just reproduced, going to fix now.
from ns-api.
Ah, my bad as well. Typo in the example that reproduces the error :) Sorry. Thanks for looking into it.
from ns-api.
No worries :) Shall I return None in both cases, or an empty list? I prefer None, as that shows that something went wrong.
from ns-api.
Yes, I also prefer None.
from ns-api.
Great. Thanks!
from ns-api.
Related Issues (19)
- Add minimal delay threshold
- Python 2-3 compatibility HOT 4
- TypeError for specific input due to missing time for TripStop HOT 5
- NS Api to change HOT 18
- Confusing departure_time_actual behavior HOT 3
- Add 'train cancelled' recognition
- Possible improvements for 3.0.2 HOT 6
- `Punctuality` key missing (sometimes) HOT 30
- TypeError: the JSON object must be str, bytes or bytearray, not NoneType HOT 6
- Multiple notifications of same disruption HOT 7
- AttributeError: 'TripStop' object has no attribute 'planned_platform' in Home Assistant HOT 14
- Get_trips result in keyerror HOT 1
- Minium delay not working for arrival times HOT 1
- Disable notifications for arrival delay
- delays may have strings in them
- Implement support for the official NS API
- Log rotation to prevent big log files
- Train "rijdt niet" needs timestamp
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 ns-api.