From dd602bb74f41fad6ae4cc9f034071d6ce21ba5c5 Mon Sep 17 00:00:00 2001 From: Ferdinando Formica Date: Tue, 17 Feb 2026 13:59:46 +0000 Subject: [PATCH 1/2] Add insights permissions --- CHANGELOG.md | 7 ++++++- ns1/__init__.py | 24 +++++------------------- ns1/rest/permissions.py | 7 +++++++ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce38110..c6438cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.27.3 (February 17th, 2026) + +ENHANCEMENTS: +* Adds support for DNS Insights permissions + ## 0.27.2 (February 10th, 2026) ENHANCEMENTS: @@ -38,7 +43,7 @@ ENHANCEMENTS: ENHANCEMENTS: * Adds support for specifying a list of views when creating zones with or without a provided zone file. * Adds support for specifying a zone name other than the FQDN when creating zones with or without a provided zone file. -* A specified list of networks for a zone was only applied to zone creation when a zone file was not provided. +* A specified list of networks for a zone was only applied to zone creation when a zone file was not provided. ## 0.21.0 (July 19th, 2024) diff --git a/ns1/__init__.py b/ns1/__init__.py index 381474c..7bcdd63 100644 --- a/ns1/__init__.py +++ b/ns1/__init__.py @@ -5,7 +5,7 @@ # from .config import Config -version = "0.27.2" +version = "0.27.3" class NS1: @@ -36,9 +36,7 @@ def _loadConfig(self, apiKey, configFile): if apiKey: self.config.createFromAPIKey(apiKey) else: - configFile = ( - Config.DEFAULT_CONFIG_FILE if not configFile else configFile - ) + configFile = Config.DEFAULT_CONFIG_FILE if not configFile else configFile self.config.loadFromFile(configFile) # REST INTERFACE @@ -300,13 +298,7 @@ def searchZone( return rest_zone.search(query, type, expand, max, callback, errback) def createZone( - self, - zone, - zoneFile=None, - callback=None, - errback=None, - name=None, - **kwargs + self, zone, zoneFile=None, callback=None, errback=None, name=None, **kwargs ): """ Create a new zone, and return an associated high level Zone object. @@ -331,11 +323,7 @@ def createZone( zone = ns1.zones.Zone(self.config, zone) return zone.create( - zoneFile=zoneFile, - name=name, - callback=callback, - errback=errback, - **kwargs + zoneFile=zoneFile, name=name, callback=callback, errback=errback, **kwargs ) def loadRecord( @@ -367,9 +355,7 @@ def loadRecord( zone = ".".join(parts[1:]) z = ns1.zones.Zone(self.config, zone) - return z.loadRecord( - domain, type, callback=callback, errback=errback, **kwargs - ) + return z.loadRecord(domain, type, callback=callback, errback=errback, **kwargs) def loadMonitors(self, callback=None, errback=None, **kwargs): """ diff --git a/ns1/rest/permissions.py b/ns1/rest/permissions.py index 5c19616..dc6849b 100644 --- a/ns1/rest/permissions.py +++ b/ns1/rest/permissions.py @@ -36,4 +36,11 @@ "view_zones": False, "zones_allow_by_default": False, }, + "redirects": { + "manage_redirects": False, + }, + "insights": { + "view_insights": False, + "manage_insights": False, + }, } From 15a94da705c8ca5541d1af3675e39b4d1a1b118a Mon Sep 17 00:00:00 2001 From: Ferdinando Formica Date: Tue, 17 Feb 2026 14:11:35 +0000 Subject: [PATCH 2/2] Fix lint --- ns1/__init__.py | 24 +++++++++++++++++++----- ns1/rest/permissions.py | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ns1/__init__.py b/ns1/__init__.py index 7bcdd63..aa56d58 100644 --- a/ns1/__init__.py +++ b/ns1/__init__.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2025 NSONE, Inc. +# Copyright (c) 2014, 2026 NSONE, Inc. # # License under The MIT License (MIT). See LICENSE in project root. # @@ -36,7 +36,9 @@ def _loadConfig(self, apiKey, configFile): if apiKey: self.config.createFromAPIKey(apiKey) else: - configFile = Config.DEFAULT_CONFIG_FILE if not configFile else configFile + configFile = ( + Config.DEFAULT_CONFIG_FILE if not configFile else configFile + ) self.config.loadFromFile(configFile) # REST INTERFACE @@ -298,7 +300,13 @@ def searchZone( return rest_zone.search(query, type, expand, max, callback, errback) def createZone( - self, zone, zoneFile=None, callback=None, errback=None, name=None, **kwargs + self, + zone, + zoneFile=None, + callback=None, + errback=None, + name=None, + **kwargs ): """ Create a new zone, and return an associated high level Zone object. @@ -323,7 +331,11 @@ def createZone( zone = ns1.zones.Zone(self.config, zone) return zone.create( - zoneFile=zoneFile, name=name, callback=callback, errback=errback, **kwargs + zoneFile=zoneFile, + name=name, + callback=callback, + errback=errback, + **kwargs ) def loadRecord( @@ -355,7 +367,9 @@ def loadRecord( zone = ".".join(parts[1:]) z = ns1.zones.Zone(self.config, zone) - return z.loadRecord(domain, type, callback=callback, errback=errback, **kwargs) + return z.loadRecord( + domain, type, callback=callback, errback=errback, **kwargs + ) def loadMonitors(self, callback=None, errback=None, **kwargs): """ diff --git a/ns1/rest/permissions.py b/ns1/rest/permissions.py index dc6849b..20f27da 100644 --- a/ns1/rest/permissions.py +++ b/ns1/rest/permissions.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2014 NSONE, Inc. +# Copyright (c) 2014, 2026 NSONE, Inc. # # License under The MIT License (MIT). See LICENSE in project root. #