arcgis.gis.nb module

NotebookServer

class arcgis.gis.nb.NotebookServer(url, gis)

Bases: object

Provides access to the ArcGIS Notebook Server administration API.

property data_access

Provides access to managing files stored on notebook server.

Returns

NotebookDataAccess object

property health_check

The health_check verifies that your ArcGIS Notebook Server site has been created, and that its Docker environment has been correctly configured.

This is only avaible if the site can be accessed around the web adapter

Returns

Boolean

property info

Returns information about the server site itself

Returns

PropertyMap

property logs

Provides access to the notebook server’s logging system

Returns

LogManager

property machine

Provides access to managing the registered machines with ArcGIS Notebook Server

Returns

MachineManager

property notebooks

Provides access to managing the ArcGIS Notebook Server’s Notebooks

Returns

NotebookManager

property properties

Properties of the object

property security

Provides access to managing the ArcGIS Notebook Server’s security settings.

Returns

SecurityManager

property services

Provices access to managing notebook created geoprocessing tools

Returns

NBServicesManager

property site

Provides access to the notebook server’s site management operations

Returns

SiteManager

property system

returns access to the system properties of the ArcGIS Notebook Server

Returns

SystemManager

property url

The URL of the notebook server.

property version

Returns the notebook server version

Returns

List

NotebookManager

class arcgis.gis.nb.NotebookManager(url, gis, nbs)

Bases: object

Provides access to managing a site’s notebooks. An object of this class can be created using notebooks property of the NotebookServer class

execute_notebook(item, update_portal_item=True, parameters=None, save_parameters=False, future=False)

The Execute Notebook operation allows administrators and users with the Create and Edit Notebooks privilege to remotely run a notebook that they own. The notebook pecified in the operation will be run with all cells in order.

Using this operation, you can schedule the execution of a notebook, either once or with a regular occurrence. This allows you to automate repeating tasks such as data collection and cleaning, content updates, and portal administration. On Linux machines, use a cron job to schedule the executeNotebook operation; on Windows machines, you can use the Task Scheduler app.

Note

To run this operation in ArcGIS Enterprise, you must log in with an Enterprise account. You cannot execute notebooks using the ArcGIS Notebook Server primary site administrator account.

You can specify parameters to be used in the notebook at execution time. If you’ve specified one or more parameters, they’ll be inserted into the notebook as a new cell. This cell will be placed at the beginning of the notebook, unless you have added the tag parameters to a cell.

Parameter

Description

item

Required Item. Opens an existing portal item.

update_portal_item

Optional Boolean. Specifies whether you want to update the notebook’s portal item after execution. The default is true. You may want to specify true when the notebook you’re executing contains information that needs to be updated, such as a workflow that collects the most recent version of a dataset. It may not be important to update the portal item if the notebook won’t store any new information after executing, such as an administrative notebook that emails reminders to inactive users.

parameters

Optional List. An optional array of parameters to add to the notebook for this execution. The parameters will be inserted as a new cell directly after the cell you have tagged parameters. Separate parameters with a comma. Use the format “x”:1 when defining parameters with numbers, and “y”:”text” when defining parameters with text strings.

save_parameters

Optional Boolean. Specifies whether the notebook parameters cell should be saved in the notebook for future use. The default is false.

future

Optional boolean. If True, a Job object will be returned and the process will not wait for the task to complete. The default is False, which means wait for results.

Returns

Dict else If future = True, then the result is a concurrent.futures.Future object. Call result() to get the response

# Usage Example:

>>> from arcgis.gis import GIS
>>> gis = GIS("home")
>>> nb_server = gis.notebook_server[0]

>>> notebook_item = gis.content.get('<notebook_item_id>')

>>> nb_mgr = nb_server.notebooks
>>> nb_mgr.execute_notebook(notebook_item)
list()

Returns a list of notebook instances on the Notebook Server

Returns

List of Notebook objects

open_notebook(itemid, templateid=None, nb_runtimeid=None, template_nb=None, *, future=False)

Opens a notebook on the notebook server

Parameter

Description

itemid

Required String. Opens an existing portal item.

templateid

Optional String. The id of the portal notebook template. To get the system templates, look at the sample notebooks group:

>>> from arcgis.gis import GIS
>>> gis = GIS()
>>> grp = gis.groups.search("title:(esri sample notebooks) AND
>>>                                 owner:"esri_notebook")[0]
>>> grp.content

nb_runtimeid

Optional String. The runtime to use to generate a new notebook.

template_nb

Optional String. The start up template for the notebook.

future

Optional Bool. If True, the job will run asynchronously.

Returns

Dict or Job

property properties

returns the properties of the resource

restore_runtime()

This operation restores the two default notebook runtimes in ArcGIS Notebook Server - ArcGIS Notebook Python 3 Standard and ArcGIS Notebook Python 3 Advanced - to their original settings.

property runtimes

Returns a list of all runtimes

Returns

List

property snapshots

Provides access to managing Notebook’s snapshots

Returns

SnapshotManager

Notebook

class arcgis.gis.nb.Notebook(url, item_id, properties=None, gis=None)

Bases: object

This represents an individual notebook resource in the notebook server.

close()

This operation stops a running notebook. You can use it to free up space in your notebook container. Idle notebooks are automatically cleaned up according to the duration defined by the idleNotebookThreshold property. The default value for that property is 24 hours.

Returns

Boolean

property properties

returns the properties of the resource

Runtime

class arcgis.gis.nb.Runtime(url, gis)

Bases: object

Provides information about the properties of a specific notebook runtime in your ArcGIS Notebook Server site

delete()

Deletes the current runtime from the ArcGIS Notebook Server

Returns

Boolean

property manifest

This resource returns a JSON representation of all the Python libraries supported in the specified notebook runtime. Notebook authors who open notebooks using this runtime are able to import any of the libraries in the manifest into their notebooks.

Returns

List of Dictionaries

property properties

returns the properties of the resource

update(name=None, image_id=None, max_cpu=None, max_memory=None, memory_unit=None, max_swap_memory=None, swap_memory_unit=None, shared_memory=None, docker_runtime=None, shared_unit=None, version=None, container_type=None, pull_string=None, require_advanced_priv=None, manifest=None)

This operation allows you to update the properties of a notebook runtime in ArcGIS Notebook Server. These settings will be applied to every container to which the runtime is applied.

You can use this operation to update the resource limits of the runtime, such as maximum CPU and maximum memory. You can also use it to extend either of the default notebook runtimes, in order to make additional Python modules available to your notebook authors, or as a step in making ArcGIS Notebook Server able to use graphical processing units (GPUs).

SnapshotManager

class arcgis.gis.nb.SnapshotManager(url, gis)

Bases: object

Allows for management and creation of snapshots (save points) for ArcGIS Notebooks.

create(item, name, description=None, notebook_json=None, access=False)

Creates a Snapshot of a Given Item.

Parameter

Description

item

Required Item. The ‘Notebook’ typed item to create a snapshot for.

name

Required String. The name of the snapshot. This is the identifier used to identify the snapshot.

description

Optional String. An piece of text that describes the snapshot.

notebook_json

Optional Dict. If you want to store different JSON text other than what is in the current notebook provide it here.

access

Optional Bool. When false, the snapshot will not be publicly available.

Returns

Dict

list(item)

Returns a list of SnapShots for a notebook item.

Parameter

Description

item

Required Item. The Notebook Item to get all snapshots for.

Returns

List of SnapShot objects

property properties

returns the properties of the endpoint

SnapShot

class arcgis.gis.nb.SnapShot(item, sm, properties)

Bases: object

A single snapshot instance for a Notebook item.

delete()

Deletes a snapshot associated with the notebook item

Parameter

Description

item

Required Item. The ‘Notebook’ typed item to remove snapshots from.

snapshot

Required String. The name of the snapshot.

Returns

Boolean

download()

Retrieves a snap shot locally on disk.

Returns

string (path of saved file)

restore(title=None, preserve=True, description=None)

Rolls back the notebook to a previous snapshot state

Parameter

Description

title

Optional string. The Item’s title.

preserve

Optional Bool. If True, the current notebook version is preserved as a snapshot.

description

Optional String. Text describing the restoration point.

Returns

Dict

save_as_item(title)

Converts a Snapshot to a new notebook Item.

Parameter

Description

title

Required String. The name of the new notebook.

Returns

Item

SystemManager

class arcgis.gis.nb.SystemManager(url, gis)

Bases: object

The System resource is a collection of server-wide resources in your ArcGIS Notebook Server site. Within this resource, you can access information and perform operations pertaining to licenses, Web Adaptors, containers, server properties, directories, Jobs, and the configuration store.

property config_store

The configuration store maintains configurations for ArcGIS Notebook Server. Typical configurations include all the resources such as machines and security rules that are required to power the site. In a way, the configuration store is a physical representation of a site.

Every ArcGIS Notebook Server machine, when it joins the site, is provided with a connection to the configuration store and it can thereafter participate in the management of the site. You can change the store’s properties during runtime using the edit operation.

The Administrator API that runs on every server machine is capable of reading and writing to the store. As a result, the store must be accessible to every server machine within the site. The default implementation is built on top of a file system and stores all the configurations in a hierarchy of folders and files.

Returns

Dict

property containers

Returns a list of active containers.

Returns

List of containers

delete_all_jobs()

Administrators can clean up an open notebook and execute notebook jobs on demand. Administrators can view and delete all jobs. Non-administrative users with create and edit notebook privileges can only view and delete their own jobs. Only jobs in completed or failed states will be cleaned up.

Returns

Boolean

property directories

Provides access to registering directories

Returns

DirectoryManager

job_details(job_id)

A job represents the asynchronous execution of an operation in ArcGIS Notebook Server. You can acquire progress information by periodically querying the job.

Parameter

Description

job_id

Required String. The unique identifier of the job.

Returns

Dict

property jobs

This resource is a collection of all the administrative jobs (asynchronous operations) created within your site. When operations that support asynchronous execution are run, ArcGIS Notebook Server creates a new job entry that can be queried for its current status and messages.

Returns

List

property licenses

Gets the license resource list. The licenses resource lists the current license level of ArcGIS Notebook Sever and all authorized extensions. Contact Esri Customer Service if you have questions about license levels or expiration properties.

list_jobs(num=100, details=False)

This resource is a collection of all the administrative jobs (asynchronous operations) created within your site. When operations that support asynchronous execution are run, ArcGIS Notebook Server creates a new job entry that can be queried for its current status and messages. This is used for Notebook Server 10.9+

Parameter

Description

details

Optional Bool. For 10.9+ Notebook Servers, to get the expanded details of a Job, set the details to True. False will provide back a shortened job status.

num

Optional Integer. The number of jobs to return. The default is 100. This is only valid on 10.9+.

Returns

List

property properties

ArcGIS Notebook Server has configuration properties that govern some of its intricate behavior. This resource is a container for these properties. The properties are available to all server objects and extensions through the server environment interface.

You can use this property to get and/or set the available properties.

#Usage Example to set property:
>>> nbserver = gis.notebook_server[0]

>>> nbserver.system.properties = {"webSocketSize" : 32}

See the REST API documention for Notebook Server System properties for current complete list of available properties.

Returns

dictionary-like PropertyMap

property recent_statistics

returns statistics about the current state of the notebook server

Returns

Dictionary

property web_adaptors

returns a list of web adapters

Returns

List

Container

class arcgis.gis.nb.Container(url, gis)

Bases: object

This represents a single hosted notebook container.

logs(count=1000)

Returns the container logs

Returns

List[str]

property notebooks

A list of all notebooks currently open in the container

Returns

List of ContainerNotebook objects

property properties

returns the properties of the resource

property sessions

When an ArcGIS Notebook is opened in a container, a computational engine called a kernel is launched; the kernel runs while the notebook is active and executes all the work done by the notebook. This resource tracks the active kernels running in the specified container to provide information about current notebook sessions.

Returns

List of Dict

Response

Description

ID

The unique ID string for the container session.

path

The working path to the running ArcGIS Notebook, ending in .ipynb.

kernel

Properties describing the kernel. They are as follows:

  • last_activity: The date and time of the most recent action performed by the kernel.

  • name: The name of the kernel. At 10.7, this value is python3.

  • id: The unique ID string for the kernel.

  • execution_state: Whether the kernel is currently executing an action or is idle.

  • connections: The number of users currently accessing the notebook.

shutdown()

Terminates the current container

Returns

Boolean

property statistics

Returns information about the current container

Returns

Dict[str,Any]

terminate()

Stops the container

Returns

Boolean

ContainerNotebook

class arcgis.gis.nb.ContainerNotebook(url, gis)

Bases: object

Represents an individual notebook container

close()

This operation stops a running notebook

Returns

Boolean

property properties

The container notebook properties

Returns

PropertyMap

DirectoryManager

class arcgis.gis.nb.DirectoryManager(url, gis)

Bases: object

Manages and maintains a collection of all server directories.

list()

returns the current registered directories

Returns

List

property properties

returns the properties of the resource

register(name, path, directory_type)

This operation registers a new data directory from your local machine with the ArcGIS Notebook Server site. Registering a local folder as a data directory allows your notebook authors to work with files in the folder.

Parameter

Description

name

The name of the directory.

path

The full path to the directory on your machine.

directory_type

The type of directory. Values: DATA | WORKSPACE | OUTPUT

Returns

Boolean

unregister(directory_id)

This operation unregisters an existing directory from the ArcGIS Notebook Server site.

Parameter

Description

directory_id

Required String. The directory ID to remove.

Returns

Boolean

WebAdaptor

class arcgis.gis.nb.WebAdaptor(url, gis)

Bases: object

This resource provides information about the ArcGIS Web Adaptor configured with your ArcGIS Notebook Server site. ArcGIS Web Adaptor is a web application that runs in a front-end web server. One of the Web Adaptor’s primary responsibilities is to forward HTTP requests from end users to ArcGIS Notebook Server in a round-robin fashion. The Web Adaptor acts a reverse proxy, providing the end users with an entry point into the system, hiding the server itself, and providing some degree of immunity from back-end failures.

The front-end web server could authenticate incoming requests against your enterprise identity stores and provide specific authentication schemes like Integrated Windows Authentication (IWA), HTTP Basic or Digest.

Most importantly, ArcGIS Web Adaptor provides your end users with a well-defined entry point into your system without exposing the internal details of your server site. ArcGIS Notebook Server will trust requests being forwarded by ArcGIS Web Adaptor and will not challenge the user for any credentials. However, the authorization of the request (by looking up roles and permissions) is still enforced by the server site.

ArcGIS Notebooks use the WebSocket protocol for communication. You can update the maximum size of the file sent using WebSocket by updating your site’s webSocketMaxHeapSize property.

unregister()

Unregisters a WebAdaptor for the Notebook Server

Returns

Boolean

WebAdaptorManager

class arcgis.gis.nb.WebAdaptorManager(url, gis)

Bases: object

Manages and configures web adaptors for the ArcGIS Notebook Server.

property config

This is a property that allows for the retreival and manipulation of web adaptors.

You can use this operation to change the Web Adaptor configuration and the sharedkey attribute. The sharedkey attribute must be present in the request.

Parameter

Description

config

Required dict. The configuration items to be updated for this web adaptor. Always include the web adaptor’s sharedkey attribute.

Returns

A boolean indicating success (True), else a Python dictionary containing an error message.

list()

Returns all registered Web Adapters

Returns

List of WebAdaptor objects

property properties

returns the properties of the resource

register(name, ip, webadaptor_url, http_port, https_port, description='')

Registers a new web adapter.

Parameter

Description

name

Required String. The name of the web adapter

ip

Required String. The IP of the web adapter.

webadaptor_url

Required String. The URI endpoint of the web adpater.

http_port

Required Integer. The port number of the web adapter

https_port

Required Integer. The secure port of the web adapter.

description

Optional String. The optional web adapter description.

Returns

Boolean

SiteManager

class arcgis.gis.nb.SiteManager(url, notebook, gis)

Bases: object

Provides the ability to update and restore notebook sites. An object of this class can be created using site property of the NotebookServer class

export_site(location)

ArcGIS Notebook Server provides this operation to back up the site’s configuration store, along with the importSite operation to restore a site configuration from a backup. The configuration store hosts essential information about the ArcGIS Notebook Server site and its machines.

The output of this operation is a ZIP file with the .agssite file extension.

There are many items and directories that are not backed up by this operation. Among them:

  • Notebooks

  • Container settings

  • Jobs directory

If desired, you can create your own file system backups for these items.

Parameter

Description

location

Required String. The folder to save the site to.

Returns

string

import_site(location)

ArcGIS Notebook Server provides this operation to restore a site configuration from a backup. The backup will have been created and exported by the exportSite operation as a ZIP file with the .agssite file extension.

Performing this operation will overwrite the current contents of your ArcGIS Notebook Server site’s configuration store with the contents from the backup. You can use it to restore a site configuration in the event of machine failure or human error.

The import operation may take a while to complete. When you execute the operation, keep the tab open on your browser until the operation completes, as a report will be delivered to the page.

Parameter

Description

location

Required String. Path to the backup site file.

Returns

Boolean

property properties

returns the properties of the resource

LogManager

class arcgis.gis.nb.LogManager(url, gis)

Bases: object

Logs are the records written by the various components of Notebook server. You can query the logs and change various log settings. An object of this class can be created using logs property of the NotebookServer class

clean()

Deletes all the log files on all server machines in the site. This is an irreversible operation.

This operation forces the server to clean the logs, which has the effect of freeing up disk space. However, it is not required that you invoke this operation because the server periodically purges old logs.

Returns

Boolean

property properties

returns the properties of the resource

query(start_time=None, end_time=None, since_server_start=False, level='WARNING', services='*', machines='*', server='*', codes=None, process_IDs=None, export=False, export_type='CSV', out_path=None)

The query operation on the logs resource provides a way to aggregate, filter, and page through logs across the entire site.

Parameter

Description

start_time

Optional string/integer. The most recent time to query. Default is now. Time can be specified in milliseconds since UNIX epoch, or as an ArcGIS Server timestamp.

Example for string: “startTime”: “2011-08-01T15:17:20”

Example for integer: “startTime”: 1312237040123

end_time

Optional string. The oldest time to include in the result set. You can use this to limit the query to the last n minutes or hours as needed. Default is the beginning of all logging.

since_server_start

Optional string. Gets only the records written since the server started (True). The default is False.

level

Optional string. Gets only the records with a log level at or more severe than the level declared here. Can be one of (in severity order): DEBUG, VERBOSE, FINE, INFO, WARNING, SEVERE. The default is WARNING.

services

Optional string. Query records related to a specific service. The default is all.

machines

Optional string. Query records related to a specific machine. The default is all.

server

Optional string. Query records related to a specific server. The default is all.

codes

Optional string. Gets only the records with the specified code. The default is all. See http://server.arcgis.com/en/server/latest/administer/windows/log-codes-overview.htm

process_IDs

Optional string. Query by the machine process ID that logged the event.

export

Optional string. Boolean indicating whether to export the query results. The default is False (don’t export).

export_type

Optional string. The export file type. CSV or TAB are the choices, CSV is the default.

out_path

Optional string. The path to download the log file to.

Returns

A JSON of the log items that match the query. If export option is set to True, the output log file path is returned.

property settings

Get/set the current log settings.

Parameter

Description

value

Required dict. A dictionary with the key/values pairs to modify settings.

Returns

PropertyMap

MachineManager

class arcgis.gis.nb.MachineManager(url, gis)

Bases: object

This resource provides the name and URL of the ArcGIS Notebook Server machine in the site. An object of this class can be created using machine property of the NotebookServer class

list()

returns all Machine instances

property properties

returns the properties of the resource

Machine

class arcgis.gis.nb.Machine(url, gis)

Bases: object

This resource provides information about the machine in your ArcGIS Notebook Server site. You can update some of these properties using the Edit Machine operation.

create_self_signed_cert(alias, keysize, common_name, org_unit, organization, city, state, country, keyalg='RSA', sigalg='SHA1withRSA', validity=90, san=None)

Use this operation to create a self-signed certificate or as a starting point for getting a production-ready CA-signed certificate. ArcGIS Notebook Server will generate a certificate for you and store it in its keystore. The certificate generated should only be used in development and staging environments.

Parameter

Description

alias

Required String. A unique name that easily identifies the certificate.

keyalg

Optional String. The algorithm used to generate the key pairs. The default is RSA.

keysize

Required String. Specifies the size in bits to use when generating the cryptographic keys used to create the certificate. The larger the key size, the harder it is to break the encryption; however, the time to decrypt encrypted data increases with key size. For DSA, the key size can be between 512 and 1,024. For RSA, the recommended key size is 2,048 or greater.

sigalg

Optional String. Use the default (SHA1withRSA). If your organization has specific security restrictions, then one of the following algorithms can be used for DSA: SHA256withRSA, SHA384withRSA, SHA512withRSA, SHA1withDSA.

common_name

Required String. Use the domain name of your server name as the common name. If your server will be accessed on the Internet through the URL https://www.notebookserver.com:11443/arcgis/, use www.notebookserver.com as the common name.If your server will only be accessible on your local area network (LAN) through the URL https://notebookserver.domain.com:11443/arcgis/, use notebookserver as the common name.

org_unit

Required String. The name of your organizational unit, for example, GIS Department.

organization

Required String. The name of your organization, for example, Esri.

city

Required String. The name of the city or locality, for example, Redlands.

state

Required String. The full name of your state or province, for example, California.

country

Required String. The abbreviated code for your country, for example, US.

validity

Required Integer. The total time in days during which this certificate will be valid, for example, 365. The default is 90.

san

Optional String. The subject alternative name (SAN) is an optional parameter that defines alternatives to the common name (CN) specified in the SSL certificate. There cannot be any spaces in the SAN parameter value. If no SAN is defined, a website can only be accessed (without SSL certificate errors) by using the common name in the URL. If a SAN is defined and a DNS name is present, the website can only be accessed by what is listed in the SAN. Multiple DNS names can be specified if desired. For example, the URLs https://www.esri.com, https://esri, and https://10.60.1.16 can be used to access the same site if the SSL certificate is created using the following SAN parameter value: DNS:www.esri.com,DNS:esri,IP:10.60.1.16

Returns

Boolean

delete_certificate(certificate)

Deletes a SSL certificate using the certificate alias.

Parameter

Description

certificate

Required string. The name of the certificate to delete

Returns

Boolean

export_certificate(certificate)

Downloads an SSL certificate. The file returned by the server is an X.509 certificate. The downloaded certificate can then be imported into a client that is making HTTP requests.

Parameter

Description

certificate

Required string. The name of the certificate in the key store.

Returns

The SSL certificate object.

generate_CSR(certificate)

Generates a certificate signing request (CSR) for a self-signed certificate. A CSR is required by a CA to create a digitally signed version of your certificate. Supply the certificate object that was created with method ssl_certificate.

Parameter

Description

certificate

Required string. The name of the certificate in the key store.

Returns

The CSR.

property hardware

This resource displays hardware information for the machine in your ArcGIS Notebook Server site. It updates the information when it detects any change to the configuration of your machine, as well as each time the machine is restarted.

Returns

Dict

import_CA_signed_certificate(certificate, ca_signed_certificate)

Imports a certificate authority (CA)-signed SSL certificate into the key store.

Parameter

Description

certificate

Required string. The name of the certificate in the key store.

ca_signed_certificate

Required string. The multi-part POST parameter containing the signed certificate file.

Returns

A boolean indicating success (True) or failure (False).

import_existing_server_certificate(alias, cert_password, cert_file)

Imports an existing server certificate, stored in the PKCS #12 format, into the keystore. If the certificate is a CA-signed certificate, you must first import the CA root or intermediate certificate using the importRootCertificate operation.

Parameter

Description

alias

Required string. A unique name for the certificate that easily identifies it.

cert_password

Required string. The password to unlock the file containing the certificate.

cert_file

Required string. The multi-part POST parameter containing the certificate file.

Returns

A boolean indicating success (True) or failure (False).

import_root_certificate(alias, root_CA_certificate)

Imports a certificate authority’s (CA) root and intermediate certificates into the keystore.

To create a production quality CA-signed certificate, you need to add the CA’s certificates into the keystore that enables the SSL mechanism to trust the CA (and the certificates it is signed). While most of the popular CA’s certificates are already available in the keystore, you can use this operation if you have a custom CA or specific intermediate certificates.

Parameter

Description

alias

Required string. The name of the certificate.

root_CA_certificate

Required string. The multi-part POST parameter containing the certificate file.

Returns

A boolean indicating success (True) or failure (False).

property properties

Get/Set the properties on the ArcGIS Notebook Server machine.

Set operation allows you to update properties on the ArcGIS Notebook Server machine.

ArcGIS Notebook Server uses port 11443 for communication. When you create a site, this is assigned as the default. You must ensure that your firewall allows communication through port 11443.

ssl_certificate(certificate)

Provides the self-signed certificate object.

Note

Even though a self-signed certificate can be used to enable SSL, it is recommended that you use a self-signed certificate only on staging or development servers.

Parameter

Description

certificate

Required string. The name of the certificate in the key store to grab information from.

Returns

The certificate object.

property ssl_certificates

Gets the list of all the certificates (self-signed and CA-signed) created for the server machine. The server securely stores these certificates inside a key store within the configuration store.

property status

Returns the Machine’s Status

Returns

Dict

unregister()

Removes this machine from the site. This server machine will no longer participate in the site or run any of the GIS services. All resources that were acquired by the server machine (memory, files, and so forth) will be released.

Typically, you should only invoke this operation if the machine is going to be shut down for extended periods of time, or if it is being upgraded.

Once a machine has been unregistered, you can create a new site or join an existing site.

Returns

A boolean indicating success (True) or failure (False).

SecurityManager

class arcgis.gis.nb.SecurityManager(url, gis)

Bases: object

This resource is a container for all resources and operations pertaining to security in your ArcGIS Notebook Server site. An object of this class can be created using security property of the NotebookServer class

property configuration

This resource returns the currently active security configuration of your ArcGIS Notebook Server site. A security configuration involves the following pieces of information, and can be modified using the Update operation.

Configuration Properties

Parameter

Description

httpsProtocols

The TLS protocols ArcGIS Notebook Server will use. Values must be comma-separated.

cipherSuites

The cipher suites ArcGIS Notebook Server will use. Values must be comma-separated.

authenticationMode

Specifies the authentication mode used by ArcGIS Notebook Server. When ArcGIS Notebook Server is federated with an Enterprise portal, this property can be included and set to ARCGIS_PORTAL_TOKEN Values: ARCGIS_TOKEN | ARCGIS_PORTAL_TOKEN

authenticationTier

The tier at which requests to access GIS services will be authenticated. You should not use this directory to modify your setting. The default value when your site is first created is NOTEBOOK_SERVER, but when you federate the site with your portal, the value is changed to ARCGIS_PORTAL.

tokenServiceKey

The key used to encrypt tokens.

Portal Properties

Parameter

Description

portalMode

Must be the value ARCGIS_PORTAL_FEDERATION

portalSecretKey

The key obtained after federating ArcGIS Notebook Server with portal.

portalURL

The URL of your portal, in the format https://webadaptorhost.domain.com/webadaptorname

referer

The referer specified when generating the token.

serverId

The ID of the server federated with the portal.

serverUrl

The external URL of the federated ArcGIS Notebook Server, in the format https://webadaptorhost.domain.com/webadaptorname

token

A token obtained from the portal for initial validation of the ArcGIS Notebook Server.

webgisServerTrustKey

A key for establishing trust between servers that are federated with the same portal.

privateHostingServerUrl

The private URL of the portal’s hosting server.

privatePortalUrl

The private URL of the portal.

When Setting the configuration the following must be defined and provided as a dictionary.

Key

Value

portalProperties

Required Dict. Portal properties represented as a JSON object.

httpsProtocols

Required String. The TLS protocols ArcGIS Server will use. Valid options are TLSv1, TLSv1.1, and TLSv1.2; values must be comma separated. By default, only TLSv1.2 is enabled.

cipherSuites

Required String. The cipher suites ArcGIS Notebook Server will use. Valid options are: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA, and TLS_RSA_WITH_3DES_EDE_CBC_SHA. By default, all of the above options are enabled. Values must be comma separated

authenticationTier

Required String. The tier at which requests to access GIS services will be authenticated. You should only indicate your setting here, rather than using this operation to modify your setting. The default value when your site is first created is NOTEBOOK_SERVER, but when you federate the site with your portal, the value is changed to ARCGIS_PORTAL. Values: WEB_ADAPTOR | NOTEBOOK_SERVER | ARCGIS_PORTAL

NotebookDataAccess

class arcgis.gis.nb._dataaccess.NotebookDataAccess(url, gis)

Bases: object

The Data Access Workspace Directory allows notebook authors to manage files used in their notebooks.

property files

Lists files that are located in the workspace directory (/arcgis/home) of the user making the request.

Returns

List[Dict[str, Any]]

upload(fp)

Uploads a file to the Notebook Server

Parameter

Description

fp

Required String. The path of the file to upload

Returns

Boolean

NotebookFile

class arcgis.gis.nb._dataaccess.NotebookFile(definition, da)

Bases: object

Represents a Single File on the ArcGIS Notebook Server

download()

Copies down the data from the server to the local machine

Returns

str as file path

erase()

Deletes a file from the system

Returns

Boolean

property properties

returns the properties of the resource

Returns

Dict

NBServicesManager

class arcgis.gis.nb._services.NBServicesManager(url, gis, nbs)

Bases: object

The NBServicesManager is used to manage the container of services published on the notebook server. An object of this class can be created using services() method of the NotebookServer class

create(item, title, description=None)

ArcGIS Notebook Server supports publishing a geoprocessing service from a notebook. The create operation creates a service when a JSON representation of the service is submitted to it.

To publish a service on Notebook Server, you must be an administrator or a user with Notebook and Publish Web Tools privileges. The notebook must belong to the user publishing the service.

A notebook-to-web tool relationship is created for maintaining the relation between the notebook and the associated web tool created for the service. This relationship ensures that ownership and sharing permissions are the same for both. When a notebook is deleted, the associated web tool is also deleted.

Parameter

Description

item

Required Item. The notebook Item to create a service from.

title

Required string. The name of the GP tool

description

Required string. The description of the tool.

Returns

Item of the tool.

property properties

Returns the manager’s properties

property services

Returns a tuple of all NBService created by the Notebook Server.

Returns

tuple

property types

The types resource provides metadata and extensions that can be enabled on GPServer service types supported in ArcGIS Notebook Server. The services framework uses this information to validate a service and construct the objects in the service. The metadata contains identifiers for each object, a default list of capabilities, properties, and other resource information. Type information for a specific service type can be accessed by appending the type name (GPServer, for example) to this URL.

Returns

Dict

NBService

class arcgis.gis.nb._services.NBService(url, gis)

Bases: object

A single ArcGIS Notebook Geoprocessing Tool.

delete()

Deletes the notebook service

Returns

Boolean

property properties

Returns the manager’s properties

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.