If you are the administrator of your organization’s ArcGIS Online account, ArcGIS Server, or Portal for ArcGIS site, this next example is useful in accessing and administering information for your site that can otherwise be redundant and tedious. As an example, let’s say you are an administrator of your organization’s ArcGIS Online account and you want to see the name, item ID, and sharing status of each of your services hosted on your account; the following script will show you how to do that:
import arcrest
from arcresthelper import securityhandlerhelper
#build dictionary of log in info to be used in security handler
login_info = {'username': raw_input("Enter User Name: "), 'password': raw_input("Enter Password: ")}
token = securityhandlerhelper.securityhandlerhelper(login_info)
#access admin...