diff --git a/update.py b/update.py index a4e9d76..882c05c 100644 --- a/update.py +++ b/update.py @@ -5,10 +5,11 @@ import sys import xml.etree.ElementTree as ET from requests import get -BASE_URL = 'https://www.namesilo.com/api/dnsUpdateRecord?version=1&type=xml&' -UPDATE_URL = '{base}key={key}&domain={domain}&rrid={rrid}&' \ +BASE_URL = 'https://www.namesilo.com/api' +UPDATE_URL = '{base}/dnsUpdateRecord?version=1&type=xml&key={key}' \ + '&domain={domain}&rrid={rrid}&' \ 'rrhost={host}&rrvalue={new_value}&rrttl=7207' -LIST_URL = '{base}key={key}&domain={domain}' +LIST_URL = '{base}/dnsListRecords?version=1&type=xml&key={key}&domain={domain}' EVERYDAY_IP_SERVICE = 'https://tool.everyday.in.th/ip?format=text' @@ -47,8 +48,13 @@ def get_namesilo_dns(key, domain, target_host): def update_namesilo_data(key, domain, rrid, subdomain, new_value): - res = get(UPDATE_URL.format(base=BASE_URL, key=key, domain=domainม - rrid=rrid, host=host, new_value=new_value)) + res = get(UPDATE_URL.format( + base=BASE_URL, + key=key, + domain=domain, + rrid=rrid, + host=subdomain, + new_value=new_value)) if res.status_code != 200: return None return True