ns1-python
ns1-python copied to clipboard
example code to do manual dns failover
can someone please point me to any reference/example code as I want to programaticaly(using NS1 python SDK) want to achieve manual dns failover
I am referring to this section in this this article: https://help.ns1.com/hc/en-us/articles/360020471254
It is also possible to enact failover and failback through the NS1 API if you want to make your own tool (like a command-line script) to quickly trigger failover or failback. One of the easiest ways to do this is to configure an NS1 API data feed for your primary IP, and publish up/down status to the feed with your tools.
In this case, two A-records are mapped to one CNAME.
However, I have tried with CNAME > A-record (1:1 mapping)
arecord = api.loadRecord('mydns-region1-.com', 'A')
arecord.update(meta={'up': False})
<Record domain=mydns-region1-.com' type=A>
arecord.data
{'domain': 'mydns-region1-.com', 'meta': {'up': False}, 'filters': [], 'ttl': 20, 'zone_name': 'mydns.com', 'networks': [0], 'zone': 'mydns.com', 'blocked_tags': [], 'id': '63fe678cfe4eaff09c08a876', 'regions': {}, 'type': 'A', 'use_client_subnet': True, 'tags': {}, 'answers': [{'answer': ['149.60.191.73'], 'id': '44066ce0be892f0084b2f9a5'}], 'link': None, 'tier': 1}
But when I am fetching the record(Api / UI), it does not reflect the above change of status
'meta': {}
Any help, much appreciated