Guest User

Untitled

a guest
Mar 23rd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import arcpy
  2. import arcgis
  3. import json
  4. from urllib.parse import urlparse
  5. from arcgis.gis import GIS
  6.  
  7. def parse_url(url):
  8. parsed_uri = urlparse( url)
  9. hostname=parsed_uri.hostname
  10. return hostname
  11.  
  12. def output_portal(portalUrl, portalAdminUser, portalAdminUserPassword):
  13. #gis = GIS(portalUrl, portalAdminUser, portalAdminUserPassword)
  14. gis=GIS()
  15. url = arcpy.GetActivePortalURL()
  16. print("Current Portal: "+url)
  17. domain=parse_url(url)
  18. portalDesc =arcpy.GetPortalDescription()
  19. outfile=open(domain+".json","w")
  20. outfile.write(json.dumps(portalDesc, indent=4, sort_keys=True))
  21. outfile.close()
  22. # get all maps posted to the portal
  23. # for each map print all the layers in the portal
Add Comment
Please, Sign In to add comment