PyForks package

Submodules

PyForks.regions module

class PyForks.regions.Regions(app_id=None, app_secret=None, debug=False)[source]

Bases: Trailforks

get_photos(**kwargs) Dict[str, Any][source]

Return a list of trail or region photos.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of photo objects to return. fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of photos to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_poi(id: int, **kwargs) Dict[str, Any][source]

Return a specific Point of Interest (POI).

Parameters:
  • id (int) – ID of the POI.

  • **kwargs – Optional parameters such as: scope (str): Detail of POI object to return. fields (str): Limit the fields returned.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_region(id: int, **kwargs) Dict[str, Any][source]

Return a specific region.

Parameters:
  • id (int) – ID of the region.

  • **kwargs – Optional parameters such as: scope (str): Detail of region object to return. fields (str): Limit the fields returned.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_region_status(since: int, **kwargs) Dict[str, Any][source]

Return region status & condition.

Parameters:
  • since (int) – Timestamp to return status after.

  • **kwargs – Optional parameters such as: rids (str): Comma-separated list of region IDs. trailids (str): Comma-separated list of trail IDs. reportdetail (int): Show details of the most recent trail report.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_regions(**kwargs) Dict[str, Any][source]

Return a list of regions.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of region object to return. fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of regions to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_ridelogs(**kwargs) Dict[str, Any][source]

Return a list of ride logs for trail or region.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of ride log object to return. fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of ride logs to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_route(id: int, **kwargs) Dict[str, Any][source]

Return a specific route.

Parameters:
  • id (int) – ID of the route.

  • **kwargs – Optional parameters such as: scope (str): Detail of route object to return. fields (str): Limit the fields returned.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_routes(**kwargs) Dict[str, Any][source]

Return a list of public routes.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of route object to return. fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of routes to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_supporters(**kwargs) Dict[str, Any][source]

Return a list of supporters for a trail, region, or route.

Parameters:

**kwargs – Optional parameters such as: fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of supporters to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_videos(**kwargs) Dict[str, Any][source]

Return a list of trail or region videos.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of video objects to return. fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of videos to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

PyForks.trails module

class PyForks.trails.Trails(app_id=None, app_secret=None, debug=False)[source]

Bases: Trailforks

get_map_trails(**kwargs) Dict[str, Any][source]

Return a list of trails within a bounding box for displaying on a map.

Parameters:

**kwargs – Optional parameters such as: output (str): Output format of the trails, default is Google encoded path. filter (str): Filter variables in the format ‘field::value;field2::value2’.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_reports(**kwargs) Dict[str, Any][source]

Return a list of reports.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of report object to return. fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of reports to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_trail(id: int, **kwargs) Dict[str, Any][source]

Return a specific trail.

Parameters:
  • id (int) – ID of the trail.

  • **kwargs – Optional parameters such as: scope (str): Detail of trail object to return. fields (str): Limit the fields returned.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_trail_status(since: int, **kwargs) Dict[str, Any][source]

Return trail status & condition for trails in region.

Parameters:
  • since (int) – Timestamp to return status after.

  • **kwargs – Optional parameters such as: rids (str): Comma-separated list of region IDs. trailids (str): Comma-separated list of trail IDs. reportdetail (int): Show details of the most recent trail report.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_trails(**kwargs) Dict[str, Any][source]

Return a list of trails.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of trail object to return. fields (str): Limit the fields returned by a comma-separated list of allowed fields. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of trails to return, max 500. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

PyForks.events module

class PyForks.events.Events(app_id=None, app_secret=None, debug=False)[source]

Bases: Trailforks

get_event(id: int, **kwargs) Dict[str, Any][source]

Return a specific event.

Parameters:
  • id (int) – ID of the event.

  • **kwargs – Optional parameters such as: scope (str): Detail of the event object to return. fields (str): Limit the fields returned.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

get_events(**kwargs) Dict[str, Any][source]

Return a list of events.

Parameters:

**kwargs – Optional parameters such as: scope (str): Detail level of event object to return. fields (str): Limit the fields returned. filter (str): Filter variables in the format ‘field::value;field2::value2’. rows (int): Number of events to return. page (int): Page through results. sort (str): Sort the results. order (str): Order the results.

Returns:

Response data from the API.

Return type:

Dict[str, Any]

PyForks.exceptions module

exception PyForks.exceptions.InvalidPermissions(msg='Invalid Permissions', *args, **kwargs)[source]

Bases: Exception

exception PyForks.exceptions.InvalidRegion(msg='Not a valid Trailforks Region', *args, **kwargs)[source]

Bases: Exception

exception PyForks.exceptions.RegionLockedAPI(msg='Invalid Permissions', *args, **kwargs)[source]

Bases: Exception

exception PyForks.exceptions.TrailforksAPIException(msg='Invalid Permissions', *args, **kwargs)[source]

Bases: Exception

PyForks.lookups module

PyForks.utilities module

PyForks.utilities.distance_string_to_miles_float(distance: str) float[source]

Trailforks report data has mixed distance values, this function attempts to normalize them into miles (float)

Parameters:

distance (str) – string of distance, 1456 ft, 2.3mi

Returns:

number of miles

Return type:

float

PyForks.utilities.feet_to_miles(feet: int) float[source]

Translate feet into miles

Parameters:

feet (int) – feet as a integer

Returns:

miles as a float

Return type:

float

PyForks.utilities.has_numbers(data: str) bool[source]

Determines if there are numbers in a string

Parameters:

data (str) – String to check

Returns:

True: numbers exist; False: numbers do not exist

Return type:

bool

PyForks.utilities.meters_to_miles(meters: float) float[source]

Translates meters to miles since the trailforks uses metric measurements for their API.

Parameters:

meters (int) – Total Meters

Returns:

Total Miles

Return type:

float

Module contents