summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--real.py16
-rw-r--r--templates/layout.html1
2 files changed, 9 insertions, 8 deletions
diff --git a/real.py b/real.py
index bf3eb0a..d19b7e1 100644
--- a/real.py
+++ b/real.py
@@ -21,16 +21,16 @@ def write_data(data, site_id):
f.write(data)
-def write_html(data, site_id):
+def write_html(data, site_id, stop_name, path):
template = env.get_template('layout.html')
- with open('{}.html'.format(site_id), 'w+') as f:
- f.write(template.render(data=data))
+ with open('{}/{}.html'.format(path, site_id), 'w+') as f:
+ f.write(template.render(data=data, stop_name=stop_name))
-def write_txt(data, site_id):
+def write_txt(data, site_id, stop_name, path):
template = env.get_template('layout.txt')
- with open('{}.txt'.format(site_id), 'w+') as f:
- f.write(template.render(data=data))
+ with open('{}/{}.txt'.format(path, site_id), 'w+') as f:
+ f.write(template.render(data=data, stop_name=stop_name))
if __name__ == '__main__':
@@ -53,5 +53,5 @@ if __name__ == '__main__':
else:
data = get_data(config['key'], config['site_id'])
- write_html(data, config['site_id'])
- write_txt(data, config['site_id'])
+ write_html(data, config['site_id'], config['stop_name'], config['output_path'])
+ write_txt(data, config['site_id'], config['stop_name'], config['output_path'])
diff --git a/templates/layout.html b/templates/layout.html
index aead13f..937a12a 100644
--- a/templates/layout.html
+++ b/templates/layout.html
@@ -23,6 +23,7 @@ p {
<div class="root">
+ <h1>{{ stop_name }}</h1>
<p>Last updated: {{ data['ResponseData']['LatestUpdate'] }}</p>
<ul>