Adjustment to support new api url format in pdns 4.x.x

This commit is contained in:
Khanh Ngo
2016-06-07 13:50:31 +07:00
parent fdd00f543a
commit 382807fdd7
3 changed files with 27 additions and 14 deletions

View File

@ -4,6 +4,7 @@ import json
import requests
import urlparse
from app import app
from distutils.version import StrictVersion
if 'TIMEOUT' in app.config.keys():
TIMEOUT = app.config['TIMEOUT']
@ -132,3 +133,12 @@ def display_time(amount, units='s', remove_seconds=True):
return final_string[:final_string.rfind(' ')]
return final_string
def pdns_api_extended_uri(version):
"""
Check the pdns version
"""
if StrictVersion(version) >= StrictVersion('4.0.0'):
return "/api/v1"
else:
return ""