ImportCredentials

サマリー

The ImportCredentials function imports credentials from a GIS Server connection file for ArcGIS Server nontoken-based secured services.

説明

The ImportCredentials function can be used to access ArcGIS Server nontoken-based secured services from GIS Server connection files. Credentials can be stored in connection files that are created in ArcGIS Pro. See Connect to a GIS Server for more information regarding creating connection files. Credentials can be cleared when you're finished using the arcpy.ClearCredentials function. The ImportCredentials function can also be used to print web maps that contain secured services from ArcGIS Server.

構文

ImportCredentials (secure_server_connections)
パラメーター説明データ タイプ
secure_server_connections
[secure_server_connections,...]

A list of credentials for secured services. Credentials can be stored in connection files that are created in ArcGIS Pro. See Connect to a GIS Server for more information regarding creating connection files.

The following connection file types are supported:

  • ArcGIS Server (.ags)
  • WMS Server (.wms)
  • WMTS Server (.wmts)

String
戻り値
データ タイプ説明
Dictionary

Returns a list of dictionary key-value pairs of credential information that can be used in the arcpy.ClearCredentials function.

コードのサンプル

ImportCredentials example
import arcpy

# import credentials
secured_credentials = arcpy.ImportCredentials([r"C:\Project\SecuredServices.ags"])
aprx = arcpy.mp.ArcGISProject(r"C:\Project\USA.aprx")
m = aprx.listMaps()[0]

# add secured service to map
m.addDataFromPath('http://SampleServer:6080/arcgis/rest/services/secured/ProjectArea/FeatureServer/0')

# clear credentials when finished
arcpy.ClearCredentials(secured_credentials)