e.denisov

to export a portal site using python

Discussion created by e.denisov on Feb 8, 2017
Latest reply on Feb 15, 2017 by JQuinn-esristaff

Can someone help me with a python script to export a portal site.

# -*- coding: utf-8 -*-
import arcrest

tokenUrl = "https://{domain}/{web-adaptor}/sharing/rest/generateToken"
org_url = "https://{domain}/{web_adaptor}/sharing/rest"

sh = arcrest.PortalTokenSecurityHandler(username="{user}", password="{pass}", org_url=org_url,
                                        token_url=tokenUrl)

org = arcrest.manageportal.PortalAdministration("https://{domain}/{web-adaptor}/portaladmin", sh)
org.exportSite(r"D:\backups\ags_portal")

Result:

 

 

I changed the script, and now there are no errors:

 

sh = arcrest.PortalTokenSecurityHandler(username="user", password="pass", org_url=org_url,
                                        token_url=tokenUrl)
psh = sh.portalServerHandler("https://servername:6443/arcgis")

arcrest.manageportal.PortalAdministration("https://domain/web-adaptor/portaladmin",
                                          psh).exportSite(r"D:\backups\ags_portal")


The script is executed, the result is not.

 

Links, name of portal admin and password are correct.

Outcomes