1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

pep8 style code corrections

This commit is contained in:
catborise 2019-09-10 09:48:31 +03:00
parent fdbb6739c1
commit 828a271789
18 changed files with 69 additions and 64 deletions

View file

@ -26,7 +26,7 @@ def os_metadata_json(request, version):
if version == 'latest':
ip = get_client_ip(request)
hostname = get_hostname_by_ip(ip)
response = { 'uuid': OS_UUID, 'hostname': hostname }
response = {'uuid': OS_UUID, 'hostname': hostname}
return HttpResponse(json.dumps(response))
else:
err = 'Invalid version: {}'.format(version)
@ -70,8 +70,8 @@ def get_client_ip(request):
def get_hostname_by_ip(ip):
try:
addrs = socket.gethostbyaddr(ip)
except Exception:
addrs = [ip,]
except:
addrs = [ip]
return addrs[0]