From ef63584f354d6d6a38acaa96a0e52dc7a7d323f0 Mon Sep 17 00:00:00 2001 From: Luca Marra Date: Wed, 8 Aug 2018 11:32:49 +0200 Subject: [PATCH] fix json_object reference before assignment json_object must be declared outside the if statement --- src/gandi-live-dns.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gandi-live-dns.py b/src/gandi-live-dns.py index 55e5757..eef57c4 100755 --- a/src/gandi-live-dns.py +++ b/src/gandi-live-dns.py @@ -54,8 +54,8 @@ def get_dnsip(uuid): url = config.api_endpoint+ '/zones/' + uuid + '/records/' + config.subdomains[0] + '/A' headers = {"X-Api-Key":config.api_secret} u = requests.get(url, headers=headers) + json_object = json.loads(u._content) if u.status_code == 200: - json_object = json.loads(u._content) print 'Checking IP from DNS Record' , config.subdomains[0], ':', json_object['rrset_values'][0].encode('ascii','ignore').strip('\n') return json_object['rrset_values'][0].encode('ascii','ignore').strip('\n') else: