X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=stevens_renderer.py;h=95a6d54c35d296339073f2cea938836eb92f0f96;hb=ea1ee5f817c01c3736a64d73d496cf35cbd383e5;hp=bf97785256933beb350d84d9ee47b87a59ca8ec2;hpb=c6d31748857aeb8f361dadf93bd00e04d60bfb70;p=kiosk.git diff --git a/stevens_renderer.py b/stevens_renderer.py index bf97785..95a6d54 100644 --- a/stevens_renderer.py +++ b/stevens_renderer.py @@ -9,17 +9,17 @@ import file_writer import renderer -logger = logging.getLogger(__file__) +logger = logging.getLogger(__name__) class stevens_renderer(renderer.abstaining_renderer): - URL = 'https://wsdot.com/Travel/Real-time/Service/api/MountainPass/Details/10' + URL = "https://wsdot.com/Travel/Real-time/Service/api/MountainPass/Details/10" def __init__(self, name_to_timeout_dict: Dict[str, int]) -> None: super().__init__(name_to_timeout_dict) def render_conditions(mp: Dict[str, str], conditions: Dict[str, str]) -> str: - ret = f''' + ret = f"""
Temp: | @@ -32,78 +32,79 @@ class stevens_renderer(renderer.abstaining_renderer):||
Roadway: | {conditions['roadCondition']} | -|
Restrictions: | -''' + | """
count = 0
- msg = conditions['restrictionOne'].get('publicPage', 'no restrictions')
- if msg.lower() != 'no restrictions':
+ msg = conditions["restrictionOne"].get("publicPage", "no restrictions")
+ if msg.lower() != "no restrictions":
count += 1
- msg = conditions['restrictionTwo'].get('publicPage', 'no restrictions')
- if msg.lower() != 'no restrictions':
+ msg = conditions["restrictionTwo"].get("publicPage", "no restrictions")
+ if msg.lower() != "no restrictions":
count += 1
if count == 2:
- ret += f'''
+ ret += f"""
{conditions['restrictionOne']['travelDirectionName']}:
{conditions['restrictionOne']['publicPage']} {conditions['restrictionTwo']['travelDirectionName']}: - {conditions['restrictionTwo']['publicPage']}''' + {conditions['restrictionTwo']['publicPage']}""" elif count == 1: - msg = conditions['restrictionOne'].get('publicPage', 'no restrictions') - if msg.lower() != 'no restrictions': - ret += f''' + msg = conditions["restrictionOne"].get("publicPage", "no restrictions") + if msg.lower() != "no restrictions": + ret += f""" {conditions['restrictionOne']['travelDirectionName']}: - {conditions['restrictionOne']['publicPage']} ''' + {conditions['restrictionOne']['publicPage']} """ else: - ret += f''' + ret += f""" {conditions['restrictionTwo']['travelDirectionName']}: - {conditions['restrictionTwo']['publicPage']} ''' + {conditions['restrictionTwo']['publicPage']} """ else: - ret += '''None. ''' - ret += ' |
{f['periodText']} | {f['forecastText']} | -