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):
|
def add_subdomain(domain):
|
||||||
|
now = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||||
if set(domain).difference(ascii_letters + '.' + digits):
|
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]')
|
print('[red]Error:[/red] Give the domain name in simple form e.g. [b]test.domain.com[/b]')
|
||||||
else:
|
else:
|
||||||
@ -160,7 +161,7 @@ def add_subdomain(domain):
|
|||||||
if response != 'Fail':
|
if response != 'Fail':
|
||||||
response_data = response.json()
|
response_data = response.json()
|
||||||
domainid = str(response_data['domain_record']['id'])
|
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()
|
conn.commit()
|
||||||
print('The domain %s has been added.' % (domain))
|
print('The domain %s has been added.' % (domain))
|
||||||
logging.info(time.strftime("%Y-%m-%d %H:%M") + ' - Info : subdomain %s added'%(domain))
|
logging.info(time.strftime("%Y-%m-%d %H:%M") + ' - Info : subdomain %s added'%(domain))
|
||||||
|
Loading…
Reference in New Issue
Block a user