woob.capabilities.travel

class Station(id=None, name=None, url=None)[source]

Bases: BaseObject

Describes a station.

Variables:
  • url – (str) url

  • name – (str) Name of station

class Departure(id=None, _type=None, _time=None, url=None)[source]

Bases: BaseObject

Describes a departure.

Variables:
  • url – (str) url

  • type – (str) Type of train

  • time – (time, datetime) Departure time

  • departure_station – (str) Departure station

  • arrival_station – (str) Destination of the train

  • arrival_time – (time, datetime) Arrival time

  • late – (time, datetime) Optional late (default: 00:00:00)

  • information – (str) Informations

  • plateform – (str) Where the train will leave

  • price – (Decimal) Price of ticket

  • currency – (str) Currency (default: None)

class RoadStep(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

A step on a roadmap.

Variables:
  • url – (str) url

  • line – (str) When line

  • start_time – (time, datetime) Start of step

  • end_time – (time, datetime) End of step

  • departure – (str) Departure station

  • arrival – (str) Arrival station

  • duration – (timedelta) Duration of this step

exception RoadmapError[source]

Bases: UserError

Raised when the roadmap is unable to be calculated.

class RoadmapFilters(id='', url=None)[source]

Bases: BaseObject

Filters to get a roadmap.

Variables:
  • url – (str) url

  • departure_time – (date, datetime) Wanted departure time

  • arrival_time – (date, datetime) Wanted arrival time

class CapTravel[source]

Bases: Capability

Travel websites.

Iterates on search results of stations.

Parameters:

pattern (str) – the search pattern

Return type:

iter[Station]

iter_station_departures(station_id, arrival_id=None, date=None)[source]

Iterate on departures.

Parameters:
  • station_id (str) – the station ID

  • arrival_id (str) – optionnal arrival station ID (default: None)

  • date (datetime.datetime) – optional date (default: None)

Return type:

iter[Departure]

iter_roadmap(departure, arrival, filters)[source]

Get a roadmap.

Parameters:
  • departure (str) – name of departure station

  • arrival (str) – name of arrival station

  • filters (RoadmapFilters) – filters on search

Return type:

iter[RoadStep]