This repository has been archived by the owner on Mar 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancements to support portal handler in manageags/administration.py
new sample to test changes
- Loading branch information
1 parent
6c70474
commit fed4ec6
Showing
3 changed files
with
118 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from arcrest.security import AGSTokenSecurityHandler,PortalTokenSecurityHandler | ||
from arcrest.manageags import AGSAdministration | ||
import arcrest | ||
if __name__ == "__main__": | ||
username = "<Username>" | ||
password = "<Password>" | ||
url = "<Org URL>" | ||
proxy_port = None | ||
proxy_url = None | ||
|
||
sH = PortalTokenSecurityHandler(username=username, | ||
password=password, | ||
org_url=url, | ||
proxy_url=proxy_url, | ||
proxy_port=proxy_port) | ||
|
||
admin = arcrest.manageorg.Administration(url=url, | ||
securityHandler=sH) | ||
try: | ||
hostingServers = admin.hostingServers() | ||
for hostingServer in hostingServers: | ||
if isinstance(hostingServer, AGSAdministration): | ||
print str(hostingServer.data.rootDataItems) | ||
print str(hostingServer.clusters) | ||
print str(hostingServer.services) | ||
print str(hostingServer.usagereports) | ||
print str(hostingServer.logs) | ||
print str(hostingServer.kml.items) | ||
print str(hostingServer.security.resources) | ||
print str(hostingServer.system) | ||
|
||
except Exception,e: | ||
print e | ||
try: | ||
username = "<UserName>" | ||
password = "<Password>" | ||
token_url = "https://<ServerURL>/<Instance>/sharing/rest/generateToken" | ||
url = "http://<ServerURL>/arcgis/admin" | ||
proxy_port = None | ||
proxy_url = None | ||
|
||
sH = AGSTokenSecurityHandler(username=username, | ||
password=password, | ||
token_url=token_url) | ||
|
||
hostingServer = AGSAdministration(url=url, securityHandler=sH, | ||
proxy_url=None, | ||
proxy_port=None, | ||
initialize=False) | ||
print str(hostingServer.data.rootDataItems) | ||
print str(hostingServer.clusters) | ||
print str(hostingServer.services) | ||
print str(hostingServer.usagereports) | ||
print str(hostingServer.logs) | ||
print str(hostingServer.kml.items) | ||
print str(hostingServer.security.resources) | ||
print str(hostingServer.system) | ||
except Exception,e: | ||
print e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters