Skip to main content

ClearCredentials

Resumen

Removes ArcGIS Server credential information from a client machine to disable access to secured services.

Debate

Credential information can be imported using the ImportCredentials function. When you're finished importing credential information, you can use the ClearCredentials function to remove ArcGIS Server credential information from a client machine to disable access to secured services. The ClearCredentials function can also be used to print web maps that contain secured services from ArcGIS Server.

Sintaxis

ClearCredentials(connections)

El parámetro Explicación Tipo de datos

connections

A list of dictionaries with key-value pairs of credential information obtained from the ImportCredentials function.

Dictionary

Muestra de código

ClearCredentials 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)