diff --git a/.gitignore b/.gitignore index 245773f..4acd06b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -run.sh +config.py diff --git a/config.py b/config.py new file mode 100755 index 0000000..fe159db --- /dev/null +++ b/config.py @@ -0,0 +1,20 @@ + +import os + +def configure_env(): + """ exports environment variables with configuration """ + + os.environ["LATITUDE"] = "…" + os.environ["LONGITUDE"] = "…" + + os.environ["GOOGLE_API_KEY"] = "…" + os.environ["TRAFFIC_FROM"] = "…+FM" + #os.environ["TRAFFIC_FROM"] = f"${LATITUDE}-${LONGITUDE}" + os.environ["TRAFFIC_1_THROUGH"] = "…+4FP" + os.environ["TRAFFIC_2_THROUGH"] = "…+V9J" + os.environ["TRAFFIC_TO"] = "…+GX" + + os.environ["AIRLY_API_KEY"] = "…" + + os.environ["OPENWEATHERMAP_API_KEY"] = "…" + diff --git a/epaper.py b/epaper.py index 56d5827..657c0be 100755 --- a/epaper.py +++ b/epaper.py @@ -1,5 +1,7 @@ #!/usr/bin/python +import config + import datetime import json import logging @@ -224,14 +226,15 @@ class AirSegment(DisplaySegment): self.temperature = measurement["value"] if __name__ == "__main__": - logging.basicConfig(level=logging.DEBUG) - segments = [ + config.configure_env() + logging.basicConfig(level=logging.DEBUG) + segments = [ ClockSegment(), WeatherSegment(), TrafficSegment(), AirSegment() ] - for segment in segments: - print(segment.get_data_text()) - print("---") + for segment in segments: + print(segment.get_data_text()) + print("---") diff --git a/run.sh b/run.sh deleted file mode 100644 index c038ad8..0000000 --- a/run.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -export LATITUDE= -export LONGITUDE= - -export GOOGLE_API_KEY=… -#export TRAFFIC_FROM= -export TRAFFIC_FROM="${LATITUDE}-${LONGITUDE}" -export TRAFFIC_1_THROUGH=6JV5+4FP -export TRAFFIC_2_THROUGH=7JFQ+V8P -export TRAFFIC_TO=6JXP+GX - -## Air information - -export AIRLY_API_KEY=… - -## Weather information - -export FORECASTIO_API_KEY= - -./epaper.py -