Skip to content

Commit

Permalink
Supporting Python 2.7
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
gabriel-laet authored May 8, 2019
1 parent fc1a59a commit aa9b6e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions local_cname/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main():
entries = []

with Action('Resolving {} ..'.format(args.to)):
results = socket.getaddrinfo(args.to, 80, type=socket.SOCK_STREAM)
results = socket.getaddrinfo(args.to, 80, 0, socket.SOCK_STREAM)
for result in results:
family, type, proto, canonname, sockaddr = result
if family in (socket.AF_INET, socket.AF_INET6):
Expand All @@ -40,9 +40,9 @@ def main():
with Action('Writing {} ..'.format(hosts_file)):
with hosts_file.open('w') as fd:
fd.write(old_contents)
fd.write('#### Start of entries generated by local-cname\n')
fd.write(u'#### Start of entries generated by local-cname\n')
for hostname, ip in entries:
fd.write('{} {}\n'.format(ip, hostname))
fd.write(u'{} {}\n'.format(ip, hostname))

time.sleep(60)
except KeyboardInterrupt:
Expand Down

0 comments on commit aa9b6e2

Please sign in to comment.