From 46750ff7aad634a0dad21b23bc21c72eb709c6b8 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 21 Feb 2018 14:45:43 +0100 Subject: Separating URL retrieval and JSON parsing --- jfr_playoff/settings.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'jfr_playoff') diff --git a/jfr_playoff/settings.py b/jfr_playoff/settings.py index acfd417..1f97e5e 100644 --- a/jfr_playoff/settings.py +++ b/jfr_playoff/settings.py @@ -25,9 +25,8 @@ class PlayoffSettings(object): new_config=None, remote_url=None, overwrite=True): try: - remote_config = new_config if new_config is not None else \ - json.loads(urllib.urlopen( - remote_url).read().decode('utf-8-sig')) + remote_file = urllib.urlopen(remote_url).read().decode('utf-8-sig') + remote_config = new_config if new_config is not None else json.loads(remote_file) for key, value in remote_config.iteritems(): if (key not in base_config) or overwrite: base_config[key] = value -- cgit v1.2.3