-
Notifications
You must be signed in to change notification settings - Fork 2
Assets
PyBuses work with two basic Assets: Buses and Stops. These assets are Python classes, and instances of these classes are used by the PyBuses methods in different ways.
Please notice that alongside PyBuses documentation, we talk about Stops and Buses, but PyBuses can be compatible with other kinds of public transport services, like Trains instead of buses, and Stations instead of Stops.
Any public transport service that will be managed with PyBuses must use one instance of the PyBuses object. This object should be threated as a concrete transport service, i.e.:
- "the bus service of King's Landing"
- "the metro service of Liberty City"
- "the bus service of Liberty City"
- "the train service of Hamburg"
- "the bus service of Hamburg"
Each one of these services would have a PyBuses object, with their getters, setters and deleters, used by all the available methods like Get Buses, Get Stop, Set Stop...
Please refer to the PyBuses Class page to learn more about the basic usage of this class, which is the core of PyBuses.
- Stops are physical locations where buses arrive to pick up passengers.
- They must have a unique identifier 'stopid' (only compatible with integers) and a 'name'.
- They can have their geographic location through coordinates (latitude as 'lat' & longitude as 'lon').
- Additional information can be stored on a dictionary under the attribute 'other'.
- PyBuses methods can use the Stop ID to retrieve a complete Stop instance or get a real-time list of the Buses coming to that stop.
- stopid - unique Stop Identifier (required, int)
- name - human-readable Stop Name (required, string)
- lat - location of this stop: Latitude (optional, float)
- lon - location of this stop: Longitude (optional, float)
- other - additional information of this Stop (optional, dict)
- Buses are moving vehicles that arrive and stop at Stops to pick up passengers.
- For each stop, it's known what buses will arrive soon and the time remaining until arrival for each one.
- Buses are identified with a 'line' and a 'route', showing their route to the passengers.
- An additional 'busid' can be used to identify individual buses.
- busid - ID of a single, concrete vehicle (optional, str, auto-generated if not provided)
- line - Bus line (required, str)
- route - Bus route (required, str, if not used by the transport service, should be the same as 'line')
- time - minutes remaining for the bus to arrive at a certain stop (optional, int or float)
- distance - how far away is the bus from a certain stop (optional, int or float)
- busid - bus ID that should be unique for a certain line and route or a certain vehicle (optional, str, auto-generated)
- other - additional information of this Bus (optional, dict)
The Bus ID can be used to identify individual, concrete vehicles. However, many APIs do not provide this information, so if the BusID is not provided, it will be automatically generated when a new Bus object is created.
The Automatic BusID is created as a MD5 hexdigest checksum. A new MD5 hash is created and then updated with the bus Line, and then with the bus Route.