Many sharing workflows in ArcGIS Pro can be automated with Python by using ArcPy functions and classes in the Sharing module and geoprocessing tools in the Publishing, Caching, and Package toolsets. You can turn Python scripts into script tools, which you can open from the Catalog and Geoprocessing panes and run as custom geoprocessing tools. Script tools can also be used in ModelBuilder models, used in the Python window, or called from another script. The workflows in each section below use different ArcPy modules, functions, classes, and geoprocessing tools.
Automate sharing web layers
You can automate sharing, overwriting, and replacing web layers with Python using a combination of ArcPy functions and geoprocessing tools in the Publishing and Package toolsets.
Automate sharing packages
You can automate creating packages using geoprocessing tools in the Package toolset and sharing them to a portal using the Share Package tool. Additionally, you can use the Share Package tool to publish tile packages, vector tile packages, or scene layer packages as web layers to ArcGIS Online or ArcGIS Enterprise.
Automate sharing a locator
You can automate sharing and updating locators with Python using a combination of the CreateGeocodeSDDraft ArcPy function and geoprocessing tools in the Publishing toolset.
Automate sharing a web tool
You can automate a geoprocessing workflow and share it as a web tool using a combination of the CreateSharingDraft ArcPy function and geoprocessing tools in the Publishing toolset.
Automate publishing services to a stand-alone server
You can automate publishing and updating services with Python using a combination of ArcPy functions and geoprocessing tools in the Publishing toolset.