From: Philipp Spitzer Date: Wed, 4 Jul 2018 18:41:36 +0000 (+0200) Subject: Add command lin eparameter --debug. X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/commitdiff_plain/f0169ec082d752abd9f29fa8d4ddda55a61d7fa7 Add command lin eparameter --debug. --- 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)