diff options
Diffstat (limited to 'sync.py')
-rwxr-xr-x | sync.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -19,6 +19,7 @@ import logging from config import get_config schema_name = get_config().get('db_schemad', 'peeringdb') +domain_name = get_config().get('domain_name', 'www.peeringdb.com') #logging.basicConfig(level=logging.DEBUG) @@ -106,7 +107,7 @@ def last_updated(kind): return int(last) def fetch_objects(s, kind, extra_params): - endpoint = f'https://peeringdb.com/api/{kind:s}' + endpoint = f'https://{domain_name:s}/api/{kind:s}' params = { 'depth': 0, 'status__in': 'ok,pending,deleted', @@ -138,7 +139,7 @@ def initial_sync(s, kind): def sync_table(s, kind): test_table(kind) - endpoint = f'https://peeringdb.com/api/{kind:s}' + endpoint = f'https://{domain_name:s}/api/{kind:s}' last = last_updated(kind) if last is None: last = int(time.time()) - 3600 @@ -176,7 +177,7 @@ def main(): req_agent = s.headers.get('User-Agent') s.headers.update({'User-Agent': f'peeringdb-simplesync/0.1 {req_agent:s}'}) - spec_url = find_spec(s, 'https://peeringdb.com/apidocs/') + spec_url = find_spec(s, f'https://{domain_name:s}/apidocs/') s.headers.update({'Accept': 'application/x-yaml'}) r = s.get(spec_url) |