Fixed bug in SQL for adding new subdomain
This commit is contained in:
parent
7380175ba0
commit
d271c44adf
3
ddns.py
3
ddns.py
@ -124,6 +124,7 @@ def add_domian(domain):
|
||||
|
||||
|
||||
def add_subdomain(domain):
|
||||
now = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
if set(domain).difference(ascii_letters + '.' + digits):
|
||||
print('[red]Error:[/red] Give the domain name in simple form e.g. [b]test.domain.com[/b]')
|
||||
else:
|
||||
@ -160,7 +161,7 @@ def add_subdomain(domain):
|
||||
if response != 'Fail':
|
||||
response_data = response.json()
|
||||
domainid = str(response_data['domain_record']['id'])
|
||||
cursor.execute('INSERT INTO subdomains values(?,?,?,?,?)',(domainid,topdomain_id,sub,ip,None,))
|
||||
cursor.execute('INSERT INTO subdomains values(?,?,?,?,?,?,?)',(domainid,topdomain_id,sub,ip,None,now,now,))
|
||||
conn.commit()
|
||||
print('The domain %s has been added.' % (domain))
|
||||
logging.info(time.strftime("%Y-%m-%d %H:%M") + ' - Info : subdomain %s added'%(domain))
|
||||
|
Loading…
Reference in New Issue
Block a user