zaanposni / vvspy Goto Github PK
View Code? Open in Web Editor NEWsimple python module for the VVS and SSB API (Verkehrsverbund Stuttgart)
Home Page: https://vvspy.readthedocs.io/en/latest/
License: MIT License
simple python module for the VVS and SSB API (Verkehrsverbund Stuttgart)
Home Page: https://vvspy.readthedocs.io/en/latest/
License: MIT License
show only time for timestamps if the requests was made for the same day else show datetime.
Summarize the feature
Currently, this project's test coverage is only 60%. Especially get_depatures()
, get_trips
, and get_arrivals()
needs to be tested. Additionally, all the data classes should be tested as well.
Example of the feature
None
Additional context
None
Summarize the feature
In my opinion, Mkdocs is a more modern and easier approach to documentation in python.
Mkdocs is also compatible with readthedocs.
Example of the feature
FastAPI, mkdocs-material
Additional context
None
Summarize the feature
To easier determine errors, it would be handy if a logging package would be used. For that, I recommend Loguru.
Example of the feature
Loguru enables the developer to just import from loguru import logger
and then use logging levels like debug, info, and error. In comparison to the default logger, Loguru logs are already nicely formatted.
Additional context
As an alternative, the built-in logging package could be used.
Describe the bug
A clear and concise description of what the bug is.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Code fragment
Let us see the important code sample that fails.
Additional context
Add any other context about the problem here.
Summarize the feature
The current setup with setup.py
and all the other settings files is not quite convenient. Additionally, the packages within the requierements.txt
are not correctly checked for compatibility. For that, I recommend using Poetry or Pipenv.
Further, I recommend switching most of the configurations to the pyproject.toml
(docs).
Example of the feature
Using Poetry, it is possible to easily manage packages using poetry add
and poetry install
. It is also possible to define different groups like dev or docs so that you can exclude not necessary packages.
Additional context
None
Hi,
I'm using VVSPY since 1 year as HomaAssistant integration and I'm very happy. I'm requesting all departures for station 'Universität' every 2 mins.
On Thursday, 16.11.2023 the S-Bahn did not operate at all in the morning due to union strike. My request with vvspy received still all S-Bahn trains - with zero delay :-), which was obviousely wrong.
The VVS website did not show the S-Bahn trains.
Is there an additional filter, i can apply for canceled trains?
Kind Regards & Thanks for your great work!
Ralf
Describe the bug
The method get_trips
triggers an exception upon retrieving a trip that contains a connection that does not have the connection.duration
attribute set.
Apparently, the VVS API does not set the duration property in case a connection takes less than a minute, i.e. the duration would be 0. This is at least what I assume to be reason for not adding the duration.
Expected behavior
The request should not fail. If no duration is given, it probably is 0 and thus does not need to be part of the final sum.
Proof of Concept
The following request is one that triggers the exception. One part of the trip contains a connection with only one stop, taking less than a minute.
from vvspy import get_trips
from datetime import datetime
trip = get_trips("de:08111:341", "de:08111:6118", trip_date=datetime(2022, 8, 1, 10, 15, 0, 0))
print(trip)
Code fragment
The problematic code can be found in https://github.com/zaanposni/vvspy/blob/master/vvspy/obj/trip.py#L33:
def __init__(self, **kwargs):
self.connections = []
for connection in kwargs.get("legs", []):
self.connections.append(Connection(**connection))
self.duration = sum([x.duration for x in self.connections])
Suggestion
It has to be checked whether the duration attribute exists. If it does not exist, (I assume that) it is equal to 0 and therefore can be left out.
self.duration = sum([x.duration for x in self.connections if x.duration])
e.g. output options (json/csv/obj/xml)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.