pyfl package
Submodules
pyfl.accident module
pyfl.air module
pyfl.bikePoint module
- class bike[source]
Bases:
objectbike class
- get_all_bike_points()[source]
Returns all the bike points
- Returns
all the bike points in london.
- Return type
dict
pyfl.cabWise module
- class cab[source]
Bases:
objectCab class
- get_taxi_information(lat, long, optype='', wheelchair=False, radius=0, name='', maxResults=20, legacyFormat=False, twentyFourSevenOnly=False)[source]
Returns taxi and minicabs contact information
- Parameters
lat (float) – latitude
long (float) – longitude
optype (str) – Operator Type e.g Minicab, Executive, Limousine
wheelchair (bool) – Wheelchair accessible
radius (int) – The radius in metres to search for operators
name (str) – The trading name of the operating company
maxResults (int) – max results to search for, defualts to 20
legacyFormat (bool) – Legacy format [NOT RECOMMENDED], defualts to False
twentyFourSevenOnly (bool) – To only search for operators which are 24/7, defualts to False
- Returns
The taxi information.
- Return type
dict
pyfl.client module
pyfl.errors module
- exception invalid_api_key(message)[source]
Bases:
PYFL_ErrorRaised when the API key is invalid.
- exception invalid_endpoint(message)[source]
Bases:
PYFL_ErrorRaised when the endpoint is invalid.
- exception invalid_parameter(message)[source]
Bases:
PYFL_ErrorRaised when the parameter is invalid.
- exception invalid_response(message)[source]
Bases:
PYFL_ErrorRaised when the response is invalid.
pyfl.helper module
- class Helper[source]
Bases:
objectUtility class to help with developing the library.
- victoria = 'victoria'
- circle = 'circle'
- district = 'district'
- HammersmithCity = 'hammersmith-city'
- Piccadilly = 'piccadilly'
- Metropolitan = 'metropolitan'
- Northern = 'northern'
- Jubilee = 'jubilee'
- Central = 'central'
- Bakerloo = 'bakerloo'
- WaterlooCity = 'waterloo-city'
- DLR = 'dlr'
- Overground = 'overground'
- TfL_Rail = 'tfl-rail'
- LondonOverground = 'london-overground'
pyfl.journeys module
- class journeys[source]
Bases:
objectJourney class
- get_available_modes()[source]
Get’s a list of all the available modes of transport
- Returns
The available modes of transport.
- Return type
dict
- perform_journey(fromcoord, tocoord)[source]
” Perform a journey between two points, note: there are many more parameters that need to be added to this function at a later date. Please refer to the docs for more information (https://api.tfl.gov.uk/swagger/ui/index.html?url=/swagger/docs/v1#!/Journey/Journey_JourneyResults).
- Parameters
fromcoord (str) – The starting location
tocoord (str) – The destination
- Returns
The journey
- Return type
dict
pyfl.mode module
pyfl.occupancy module
- class Occupancy[source]
Bases:
objectOccupancy class
- get_car_park_occupancy(id='')[source]
Returns the current occupancy of a car park
- Parameters
id (string) – The id of the car park, defualts to all
- Returns
The occupancy of the car park.
- Return type
dict
pyfl.place module
- class Place[source]
Bases:
objectPlace class
- get_place_catagories()[source]
Get all the place catagories
- Returns
The place catagories
- Return type
dict
- get_street(postcode)[source]
Get the street for a given postcode
- Parameters
postcode (str) – The postcode to get the street for
- Returns
The street
- Return type
dict
- get_places_by_type(type=[], activeOnly=False)[source]
Get all the places of a given type
- Parameters
type (list) – The type of place to get
activeOnly – Only return active places, defaults to False
- Returns
The places
- Return type
dict
- get_places_by_id(id)[source]
Get a place by it’s id
- Parameters
id (str) – The id of the place
- Returns
The place
- Return type
dict
- get_places_by_location(radius, lat, long, type='', catagories=[], includeChildren=False, activeOnly=False, max=20)[source]
Get all the places of a given type within a given radius of a given location
- Parameters
radius (int) – The radius to search in
lat (float) – The latitude of the location
long (float) – The longitude of the location
type (str) – The type of place to get (optional)
catagories (list) – The catagories of place to get (optional)
includeChildren (bool) – Include child places, defaults to False
activeOnly (bool) – Only return active places, defaults to False
max (int) – The maximum number of places to return, defaults to 20
- Returns
The places
- Return type
dict
- get_place_by_type_and_location(type, lat, long)[source]
Get all the places of a given type within a given radius of a given location
- Parameters
type (list) – The type of place to get
lat (float) – The latitude of the location
long (float) – The longitude of the location
- Returns
The places
- Return type
dict
- get_place_by_type(name)[source]
Get a place by it’s name
- Parameters
name (str) – The name of the place
- Returns
The place
- Return type
dict
- get_place_overlay(z, type, width, height, lat, long)[source]
Get the overlay for a given place
- Parameters
z (int) – The zoom level
type (list) – The type of place to get
width (int) – The width of the overlay
height (int) – The height of the overlay
lat (int) – The latitude of the location
long (int) – The longitude of the location
- Returns
The overlay
- Return type
dict
pyfl.road module
- class Road[source]
Bases:
objectRoad Class
- get_road(road_id='')[source]
Gets the road with the given id
- Parameters
road_id – The id of the road (optional)
- Type
str
- Returns
All the roads managed by TFL
- Return type
dict
- get_road_status(road_id, dataRangeNullableStart, dataRangeNullableEnd)[source]
Gets the status of the road with the given id
- Parameters
road_id – The id of the road
dataRangeNullableStart – The start date (optional)
dataRangeNullableEnd – The end date (optional)
- Type
str
- Type
str
- Type
str
- Returns
The status of the road
- Return type
dict
- get_active_disruptions(road_id, stripContent=False, severities='', catagories='', closures=True)[source]
Get’s a list of all the active disruptions, filtered by the road ID
- Param
road_id: The id of the road
- Type
str
- Param
stripContent: Optional, defaults to false. When true, removes every property/node except for id, point, severity, severityDescription, startDate, endDate, corridor details, location, comments and streets
- Type
bool
- Param
severities: Optional, defaults to empty string. When set, filters the results by severity. Can be comma separated list of severities. (a valid list of severities can be obtained from the road.get_road_disruption_severities() function)
- Type
str
- Param
catagories: Optional, defaults to empty string. When set, filters the results by category. Can be comma separated list of categories. (a valid list of categories can be obtained from the road.get_road_disruption_catagories() function)
- Type
str
- Param
closures: Optional, defaults to true. When true, always includes disruptions that have road closures, regardless of the severity filter. When false, the severity filter works as normal.
- Type
bool
- Returns
A list of all the active disruptions
- Return type
dict
- get_all_disruptions(startDate='', endDate='')[source]
Gets a list of all the disruptions
- Param
startDate: Optional, defaults to empty string. When set, filters the results by start date. Must be in the format YYYY-MM-DD
- Type
str
- Param
endDate: Optional, defaults to empty string. When set, filters the results by end date. Must be in the format YYYY-MM-DD
- Type
str
- Returns
A list of all the disruptions
- Return type
dict
pyfl.search module
- class Search[source]
Bases:
objectSearch class
- search(query)[source]
Searches the TFL website for any references of the query, returns 100 results
- Parameters
query – The query which to search
- Type
str
- Returns
Any references of the query
- Return type
dict
- search_bus_schedule(query)[source]
Searches the TFL website for a bus number
- Parameters
query – The query which to search
- Type
str
- Returns
The schedule of the busses
- Return type
dict
pyfl.stop module
- class Stop[source]
Bases:
objectStop class
- get_stop_catagories()[source]
Returns a list of all available stop catagories
- Returns
A list of all available stop catagories
- Return type
dict
- get_stop_types()[source]
Returns a list of all available stop types
- Returns
A list of all available stop types
- Return type
dict
- get_stop_modes()[source]
Returns a list of all available stop modes
- Returns
A list of all available stop modes
- Return type
dict
- get_stop_by_id(stopID, includeCrowding=False)[source]
Returns a stop by its ID
- Parameters
stopID (str) – A comma-separated list of stop point ids (station naptan code e.g. 940GZZLUASL). Max. approx. 20 ids. You can use /StopPoint/Search/{query} endpoint to find a stop point id from a station name.
includeCrowding (bool) – Include the crowding data (static). To Filter further use: /StopPoint/{ids}/Crowding/{line} (optional, default to False)
- Returns
The stop
- Return type
dict
- get_place_by_id(placeID, placeType)[source]
Returns a place by its ID
- Parameters
placeID (str) – A naptan id for a stop point (station naptan code e.g. 940GZZLUASL).
placeType (str) – A comcomma-separated value representing the place types
- Returns
The place
- Return type
dict
- get_crowding_data(placeID, line='', direction='')[source]
Gets all the Crowding data (static) for the StopPointId, plus crowding data for a given line and optionally a particular direction.
- Parameters
placeID (str) – The Naptan id of the stop
line (str) – A particular line e.g. victoria, circle, northern etc. Optionally you can use in helper.victora (optional, default to None)
direction (str) – The direction of travel. Can be inbound or outbound. (optional, default to None)
- Returns
The crowding data
- Return type
dict
- get_all_stop_points_by_type(type, page=0)[source]
Returns all stop points of a given type
- Parameters
type (str) – A comma-separated list of the types to return. Max. approx. 12 types. A list of valid stop types can be obtained from the StopPoint/meta/stoptypes endpoint.
page (int) – The page number to return (optional, default to None)
- Returns
All stop points of a given type
- Return type
dict
- get_service_type_of_stoppoint(id, lineID=[], modes=[])[source]
Gets the service types for a given stoppoint
- Parameters
id (str) – The Naptan id of the stop
lineID (array) – A particular line e.g. victoria, circle, northern etc. Optionally you can use in helper.victora (optional, default to None)
modes – The modes which the lines are relevant to
- Returns
The service types for a given stoppoint
- Return type
dict
- get_arrival_predictions(stopID)[source]
Gets the list of arrival predictions for the given stop point id
- Parameters
stopID (str) – A StopPoint id (station naptan code e.g. 940GZZLUASL, you can use /StopPoint/Search/{query} endpoint to find a stop point id from a station name)
- Returns
The list of arrival predictions for the given stop point id
- Return type
dict
pyfl.travel module
- class Travel[source]
Bases:
objectTravel class
- get_travel_time_overlay(z, pin_lat, pin_long, mapCenterLat, mapCenterLon, scenarioTitle, timeOfDay, modeID, width, height, direction, travelTime)[source]
Generates a travel time overlay
- Parameters
z (int) – Zomm level
pin_lat (float) – Latitude of the pin
pin_long (float) – Longitude of the pin
mapCenterLat (float) – Latitude of the map center
mapCenterLon (float) – Longitude of the map center
scenarioTitle (str) – Title of the scenario
timeOfDay (str) – Time of day
modeID (str) – Mode ID
width (int) – The width of the requested overlay
height (int) – The height of the requested overlay
direction (str) – Direction of travel (From, To, Average) (optional, default to Average)
travelTime (int) – The total minutes between the travel time bands
- Returns
The travel time overlay
- Return type
dict
- compare_travel_time_overlay(z, pin_lat, pin_long, mapCenterLat, mapCenterLon, scenarioTitle, timeOfDay, modeID, width, height, direction, travelTime, compareType, compareValue)[source]
Generates a travel time overlay
- Parameters
z (int) – Zomm level
pin_lat (float) – Latitude of the pin
pin_long (float) – Longitude of the pin
mapCenterLat (float) – Latitude of the map center
mapCenterLon (float) – Longitude of the map center
scenarioTitle (str) – Title of the scenario
timeOfDay (str) – Time of day
modeID (str) – Mode ID
width (int) – The width of the requested overlay
height (int) – The height of the requested overlay
direction (str) – Direction of travel (From, To, Average) (optional, default to Average)
travelTime (int) – The total minutes between the travel time bands
compareType (str) – The type of comparison (Scenario, TimeOfDay, Mode)
- Returns
The travel time overlay
- Return type
dict