From 981fdad9a83c1a606c0e9f0f319e48338f3c384c Mon Sep 17 00:00:00 2001 From: Leigh Phillips Date: Sat, 16 Jan 2021 15:29:59 -0800 Subject: [PATCH] Update main.py Add * for tags wildcard & default NAMESPACE to None. --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 1e428dd..57673b3 100755 --- a/main.py +++ b/main.py @@ -5,7 +5,7 @@ import os from influxdb import InfluxDBClient # InfluxDB Settings -NAMESPACE = os.getenv('NAMESPACE', '') +NAMESPACE = os.getenv('NAMESPACE', 'None') DB_ADDRESS = os.getenv('INFLUX_DB_ADDRESS', 'influxdb') DB_PORT = int(os.getenv('INFLUX_DB_PORT', '8086')) DB_USER = os.getenv('INFLUX_DB_USER', '') @@ -66,12 +66,16 @@ def tag_selection(data): 'speedtest_url': data['result']['url'] } + if tags == '*': + return tag_switch + options = {} tags = tags.split(',') for tag in tags: # split the tag string, strip and add selected tags to {options} with corresponding tag_switch data tag = tag.strip() options[tag] = tag_switch[tag] + return options