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:
parent
fdbb6739c1
commit
828a271789
18 changed files with 69 additions and 64 deletions
|
|
@ -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]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue