From 6e35cfb44b8a215674d01dc0b380db31c5ddae2d Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Sun, 8 Oct 2017 16:14:33 +0200 Subject: [PATCH] Fix whitespace and move config getting into try --- python_apps/pypo/pypo/pypofile.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/python_apps/pypo/pypo/pypofile.py b/python_apps/pypo/pypo/pypofile.py index ba2fea1c0..14c8fba9c 100644 --- a/python_apps/pypo/pypo/pypofile.py +++ b/python_apps/pypo/pypo/pypofile.py @@ -61,14 +61,13 @@ class PypoFile(Thread): self.logger.info("copying from %s to local cache %s" % (src, dst)) CONFIG_SECTION = "general" - username = self._config.get(CONFIG_SECTION, 'api_key') - baseurl = self._config.get(CONFIG_SECTION, 'base_url') - port = self._config.get(CONFIG_SECTION, 'base_port', 80) - protocol = self._config.get(CONFIG_SECTION, 'protocol', str(("http", "https")[int(port) == 443])) - - try: - host = [protocol, baseurl, port] + try: + username = self._config.get(CONFIG_SECTION, 'api_key') + baseurl = self._config.get(CONFIG_SECTION, 'base_url') + port = self._config.get(CONFIG_SECTION, 'base_port', 80) + protocol = self._config.get(CONFIG_SECTION, 'protocol', str(("http", "https")[int(port) == 443])) + host = [protocol, baseurl, port] url = "%s://%s:%s/rest/media/%s/download" % (host[0], host[1], host[2],