ns1.NS1¶
This top level object is used to initialize and coordinate access to the NS1 platform. With it, you create objects for accessing either the basic REST interface, or the high level objects such as Zone and Record.
-
class
ns1.
NS1
(apiKey=None, config=None, configFile=None, keyID=None)¶ Create a new top level NS1 API object
Parameters: - apiKey (str) – if given, initialize config with this API key (obtainable via creation in NS1 portal)
- config (ns1.config.Config) – if given, uses a separately constructed and configured Config object
- configFile (str) – if given, load configuration from the given json configuration file
- keyID (str) – if given, use the specified key config in the multi-key configuration file
-
createZone
(zone, zoneFile=None, callback=None, errback=None, **kwargs)¶ Create a new zone, and return an associated high level Zone object. Several optional keyword arguments are available to configure the SOA record.
If zoneFile is specified, upload the specific zone definition file to populate the zone with.
Parameters: Return type:
-
datafeed
()¶ Return a new raw REST interface to feed resources
Return type: ns1.rest.data.Feed
-
datasource
()¶ Return a new raw REST interface to datasource resources
Return type: ns1.rest.data.Source
-
loadRecord
(domain, type, zone=None, callback=None, errback=None, **kwargs)¶ Load an existing record into a high level Record object.
Parameters: Return type:
-
loadZone
(zone, callback=None, errback=None)¶ Load an existing zone into a high level Zone object.
Parameters: zone (str) – zone name, like ‘example.com’ Return type: ns1.zones.Zone
-
monitors
()¶ Return a new raw REST interface to monitors resources
Return type: ns1.rest.monitoring.Monitors
-
notifylists
()¶ Return a new raw REST interface to notify list resources
Return type: ns1.rest.monitoring.NotifyLists
-
plan
()¶ Return a new raw REST interface to account plan
Return type: ns1.rest.account.Plan
-
records
()¶ Return a new raw REST interface to record resources
Return type: ns1.rest.records.Records
-
searchZone
(zone, q=None, has_geo=False, callback=None, errback=None)¶ Search a zone for a given search query (e.g., for geological data, etc)
Parameters: zone – NOT a string like loadZone - an already loaded ns1.zones.Zone, like one returned from loadZone Returns:
-
stats
()¶ Return a new raw REST interface to stats resources
Return type: ns1.rest.stats.Stats
-
zones
()¶ Return a new raw REST interface to zone resources
Return type: ns1.rest.zones.Zones