pyfl package

Submodules

pyfl.accident module

class Accident

Bases: object

Accident class

get_accident_stats(year)

Returns the accident statistics for a given year

Parameters

kind (str) – Year for the stats to get.

Returns

The stats for that year.

Return type

dict

pyfl.air module

class AirQuality

Bases: object

AirQuality class

get_air_quality()

Returns the current air quality in london

Returns

The air quality in london.

Return type

dict

pyfl.bikePoint module

class bike

Bases: object

bike class

get_all_bike_points()

Returns all the bike points

Returns

all the bike points in london.

Return type

dict

get_bike_point(id)

Returns a specfic bike point

Parameters

id (int) – id of the bike point to get.

Returns

the bike point.

Return type

dict

get_bike_point_by_name(name)

Returns a specfic bike point

Parameters

name (str) – name of the bike point to get.

Returns

the bike point.

Return type

dict

pyfl.cabWise module

class cab

Bases: object

Cab class

get_taxi_information(lat, long, optype='', wheelchair=False, radius=0, name='', maxResults=20, legacyFormat=False, twentyFourSevenOnly=False)

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

class client(api_key)

Bases: object

pyfl.errors module

exception PYFL_Error(message)

Bases: Exception

Base class for all PYFL errors.

exception invalid_api_key(message)

Bases: PYFL_Error

Raised when the API key is invalid.

exception invalid_endpoint(message)

Bases: PYFL_Error

Raised when the endpoint is invalid.

exception invalid_parameter(message)

Bases: PYFL_Error

Raised when the parameter is invalid.

exception invalid_response(message)

Bases: PYFL_Error

Raised when the response is invalid.

pyfl.helper module

class Helper

Bases: object

victoria = 'victoria'
static make_raw_api_call(endpoint)

Make a raw API call to the TFL API

static parse(json_data)

A lot of the TFL API returns a lot of crap, this function removes it…

pyfl.journeys module

class journeys

Bases: object

Journey class

get_available_modes()

Get’s a list of all the available modes of transport

Returns

The available modes of transport.

Return type

dict

perform_journey(fromcoord, tocoord)

” 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

class Mode

Bases: object

Mode class

get_mode()

Returns the service type for a given mode

Returns

The service type for a given mode.

Return type

dict

get_arrival_predictions(mode, count=-1)

Get’s the arrival predictions for all stops of a given mode

Parameters
  • mode (str) – The mode to get the arrival predictions for.

  • count (int) – The number of arrivals to return, defaults to -1 (all)

Returns

The arrival predictions.

Return type

dict

pyfl.occupancy module

class Occupancy

Bases: object

Occupancy class

get_car_park_occupancy(id='')

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

get_charge_point_occupancy(id=[])

Returns the current occupancy of a charge point

Parameters

id (array) – The id of the charge point, defualts to all

Returns

The occupancy of the charge point.

Return type

dict

get_bike_point_occupancy(id)

Returns the current occupancy of a bike point

Parameters

id (list) – The id of the bike point

Returns

The occupancy of the bike point.

Return type

dict

pyfl.place module

class Place

Bases: object

get_place_catagories()

Get all the place catagories

Returns

The place catagories

Return type

dict

get_place_types()

Get all the place types

Returns

The place types

Return type

dict

get_street(postcode)

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)

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)

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)

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)

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)

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)

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.tube module

class LU

Bases: object

Line class

get_line_status(line)

Returns the status of a line

Parameters

kind (str) – Status of the line to get.

Returns

The line status.

Return type

dict

Module contents