Merge pull request #252 from radiorabe/fix/pypo-tls-support
Use proper protocol in URL if port is set to 443
This commit is contained in:
commit
c3bd93779b
|
@ -64,8 +64,12 @@ class PypoFile(Thread):
|
||||||
username = self._config.get(CONFIG_SECTION, 'api_key')
|
username = self._config.get(CONFIG_SECTION, 'api_key')
|
||||||
host = self._config.get(CONFIG_SECTION, 'base_url')
|
host = self._config.get(CONFIG_SECTION, 'base_url')
|
||||||
port = self._config.get(CONFIG_SECTION, 'base_port', 80)
|
port = self._config.get(CONFIG_SECTION, 'base_port', 80)
|
||||||
url = "http://%s:%s/rest/media/%s/download" % (host, port, media_item["id"])
|
|
||||||
self.logger.error(url)
|
url = "%s://%s:%s/rest/media/%s/download" % (str(("http", "https")[int(port) == 443]),
|
||||||
|
host,
|
||||||
|
port,
|
||||||
|
media_item["id"])
|
||||||
|
self.logger.info(url)
|
||||||
with open(dst, "wb") as handle:
|
with open(dst, "wb") as handle:
|
||||||
response = requests.get(url, auth=requests.auth.HTTPBasicAuth(username, ''), stream=True, verify=False)
|
response = requests.get(url, auth=requests.auth.HTTPBasicAuth(username, ''), stream=True, verify=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue