Fix a bug, and better error message when querying account server.

This commit is contained in:
jpmeijers 2017-03-09 01:33:25 +01:00
parent 2e719cf9ba
commit dd71c64ab5

4
run.py
View File

@ -89,7 +89,7 @@ if(os.getenv('SERVER_TTN', True)):
response = urllib2.urlopen(req, timeout=30) response = urllib2.urlopen(req, timeout=30)
config_response = response.read() config_response = response.read()
except urllib2.URLError as err: except urllib2.URLError as err:
print ("Unable to fetch configuration from TTN") print ("Unable to fetch configuration from TTN. Are your GW_ID and GW_KEY correct?")
sys.exit(0) sys.exit(0)
# Parse config # Parse config
@ -104,7 +104,7 @@ if(os.getenv('SERVER_TTN', True)):
frequency_plan_url = ttn_config.get('frequency_plan_url', "https://account.thethingsnetwork.org/api/v2/frequency-plans/EU_863_870") frequency_plan_url = ttn_config.get('frequency_plan_url', "https://account.thethingsnetwork.org/api/v2/frequency-plans/EU_863_870")
if "router" in ttn_config: if "router" in ttn_config:
router = ttn_config.['router'].get('mqtt_address', "router.dev.thethings.network:1883") router = ttn_config['router'].get('mqtt_address', "router.dev.thethings.network:1883")
router = router[:router.index(':')] #strip port from url, as this is added by mp_pkt_fwd router = router[:router.index(':')] #strip port from url, as this is added by mp_pkt_fwd
else: else:
router = "router.dev.thethings.network" router = "router.dev.thethings.network"