X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/f87afe736463c73529488050e5190a7ca9d0e1f8..ca2ff71b9a5b9d5efcdec8ec56c43c74f0818f4f:/owm.py?ds=sidebyside diff --git a/owm.py b/owm.py index 323ab9d..c57b242 100755 --- a/owm.py +++ b/owm.py @@ -15,8 +15,6 @@ import datetime import math from seeparklib.openweathermap import openweathermap_json -debug = False - def fromtimestamp(timestamp, format): return datetime.datetime.fromtimestamp(timestamp).strftime(format) @@ -74,7 +72,7 @@ def write_csv(csv_file, weather_data): ]) -def main(configfile): +def main(configfile, debug): config = configparser.ConfigParser() config.read(configfile) apikey = config.get('openweathermap', 'apikey') @@ -99,5 +97,6 @@ if __name__ == '__main__': default_config_file = os.path.expanduser('~/seewasser.ini') parser = argparse.ArgumentParser(description='Get OpenWeathermap data') parser.add_argument('--config', default=default_config_file, help='configuration file') + parser.add_argument('--debug', action='store_true', default=False, help='print debug information') args = parser.parse_args() - main(args.config) + main(args.config, args.debug)