mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-06-05 03:49:38 +00:00
pep8 style code corrections
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user