text encoding

This commit is contained in:
stryan 2023-07-24 18:21:46 -04:00
parent 9288aa5857
commit aab918351f
2 changed files with 9 additions and 10 deletions

View File

@ -1,10 +1,10 @@
import os
api_secret = os.environ.get("GANDI_API_SECRET", "TOKEN")
api_endpoint = os.environ.get("GANDI_API_ENDPOINT",'https://dns.api.gandi.net/api/v5')
api_secret = os.environ.get("GANDI_API_SECRET", "TOKEN").replace("\"","")
api_endpoint = os.environ.get("GANDI_API_ENDPOINT",'https://dns.api.gandi.net/api/v5').replace("\"","")
static_ip = os.environ.get("GANDI_STATIC_IP","")
domain = os.environ.get("GANDI_DOMAIN","")
subdomains = os.environ.get("GANDI_SUBDOMAINS","").split(",")
ttl = os.environ.get("GANDI_TIMEOUT","300")
ifconfig = os.environ.get("GANDI_IFCONFIG","https://ifconfig.co/ip")
static_ip = os.environ.get("GANDI_STATIC_IP","").replace("\"","")
domain = os.environ.get("GANDI_DOMAIN","").replace("\"","")
subdomains = os.environ.get("GANDI_SUBDOMAINS","").replace("\"","").split(",")
ttl = os.environ.get("GANDI_TIMEOUT","300").replace("\"","")
ifconfig = os.environ.get("GANDI_IFCONFIG","https://ifconfig.co/ip").replace("\"","")

View File

@ -59,8 +59,8 @@ def get_dnsip(uuid):
u = requests.get(url, headers=headers)
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')
print('Checking IP from DNS Record' , config.subdomains[0], ':', json_object['rrset_values'][0].encode('ascii','ignore').decode().strip('\n'))
return json_object['rrset_values'][0].strip('\n')
else:
print('Error: HTTP Status Code ', u.status_code, 'when trying to get IP from subdomain', config.subdomains[0])
print(json_object['message'])
@ -96,7 +96,6 @@ def main(force_update, verbosity):
if verbosity:
print("verbosity turned on - not implemented by now")
#get zone ID from Account
uuid = get_uuid()