Refactor code
This commit is contained in:
parent
a5dbf73df4
commit
0dc6a0b6c5
3 changed files with 14 additions and 15 deletions
|
|
@ -120,14 +120,11 @@ class OnionrUtils:
|
|||
|
||||
def getMyAddress(self):
|
||||
try:
|
||||
myAddressFile = open("data/hs/hostname", 'r')
|
||||
myAddress = myAddressFile.read()
|
||||
myAddressFile.close()
|
||||
|
||||
return myAddress.strip()
|
||||
with open('./data/hs/hostname', 'r') as hostname:
|
||||
return hostname.read().strip()
|
||||
except Exception as error:
|
||||
logger.error('Failed to read my address.', error=error)
|
||||
return ''
|
||||
return None
|
||||
|
||||
def localCommand(self, command, silent = True):
|
||||
'''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue