Skip to content
Snippets Groups Projects
Verified Commit 9930d6d4 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

compat for python3.5

parent dfd1ab8f
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,7 @@ def get_vhosts(config: Path) -> list:
# capture server blocks
servers = re.compile(r"^server\s+{(?:\s*(?!server\s{).)+", re.M)
with open(config) as config_fo:
with open(str(config)) as config_fo:
config_content = sanitize.sub(r"", config_fo.read())
vhosts = servers.findall(config_content)
......@@ -58,7 +58,7 @@ def get_hostnames(vhost: str) -> list:
hostnames = []
for line in vhost.splitlines():
if server_names.match(line):
hostnames.extend(server_names.match(line)[1].split())
hostnames.extend(server_names.match(line).group(1).split())
return hostnames
......@@ -71,7 +71,7 @@ def get_ports(vhost: str) -> list:
for line in vhost.splitlines():
if listens.match(line):
ports.append(
(listens.match(line)[1], "https" if listens.match(line)[2] else "http")
(listens.match(line).group(1), "https" if listens.match(line).group(2) else "http")
)
return ports
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment