Added error suppression
This commit is contained in:
parent
eff8af898c
commit
b35bf977f9
6
main.py
6
main.py
@ -50,6 +50,7 @@ class AliDDNS(object):
|
|||||||
else:
|
else:
|
||||||
print("Your ipv4 address is:", self.__v4)
|
print("Your ipv4 address is:", self.__v4)
|
||||||
|
|
||||||
|
try:
|
||||||
describe_v4 = DescribeDomainRecordsRequest()
|
describe_v4 = DescribeDomainRecordsRequest()
|
||||||
describe_v4.set_accept_format('json')
|
describe_v4.set_accept_format('json')
|
||||||
|
|
||||||
@ -75,6 +76,8 @@ class AliDDNS(object):
|
|||||||
|
|
||||||
self.__client.do_action_with_exception(update_v4)
|
self.__client.do_action_with_exception(update_v4)
|
||||||
print('Your ipv4 record has been updated successfully.')
|
print('Your ipv4 record has been updated successfully.')
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to update your ipv4 record,", e)
|
||||||
|
|
||||||
|
|
||||||
# Get local public ipv6 address
|
# Get local public ipv6 address
|
||||||
@ -86,6 +89,7 @@ class AliDDNS(object):
|
|||||||
else:
|
else:
|
||||||
print("Your ipv6 address is:", self.__v6)
|
print("Your ipv6 address is:", self.__v6)
|
||||||
|
|
||||||
|
try:
|
||||||
describe_v6 = DescribeDomainRecordsRequest()
|
describe_v6 = DescribeDomainRecordsRequest()
|
||||||
describe_v6.set_accept_format('json')
|
describe_v6.set_accept_format('json')
|
||||||
|
|
||||||
@ -111,6 +115,8 @@ class AliDDNS(object):
|
|||||||
|
|
||||||
self.__client.do_action_with_exception(update_v6)
|
self.__client.do_action_with_exception(update_v6)
|
||||||
print('Your ipv6 record has been updated successfully.')
|
print('Your ipv6 record has been updated successfully.')
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to update your ipv4 record,", e)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dns = AliDDNS("MainDomain.com", "SubDomain", "AccessKey ID", "AccessKey Secret")
|
dns = AliDDNS("MainDomain.com", "SubDomain", "AccessKey ID", "AccessKey Secret")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user