def getServiceList(server, port, adminUser, adminPass, useSSL=True, token=None):    
    
    
    if token is None:    
        token = gentoken(server, port, adminUser, adminPass, useSSL)    
    
    services = []    
    folder = ''    
    URL = "{}{}{}/arcgis/admin/services{}?f=pjson&token={}".format(getProtocol(useSSL), server, getPort(port), folder, token)    

    serviceList = json.loads(urllib2.urlopen(URL).read())

    # Build up list of services at the root level
    for single in serviceList["services"]:
        services.append(single['serviceName'] + '.' + single['type'])
     
    # Build up list of folders and remove the System and Utilities folder (we dont want anyone playing with them)
    folderList = serviceList["folders"]
    folderList.remove("Utilities")             
    folderList.remove("System")
        
    if len(folderList) > 0:
        for folder in folderList:                                              
            URL = "{}{}{}/arcgis/admin/services/{}?f=pjson&token={}".format(getProtocol(useSSL), server, getPort(port), folder, token)    
            fList = json.loads(urllib2.urlopen(URL).read())
            
            for single in fList["services"]:
                services.append(folder + "//" + single['serviceName'] + '.' + single['type'])                
     
    return services
Function to get all services
dataset/ETHPy150Open Esri/ops-server-config/SupportFiles/AGSRestFunctions.py/getServiceList