当前位置: 首页>>代码示例>>Python>>正文


Python Users.deleteUser方法代码示例

本文整理汇总了Python中users.Users.deleteUser方法的典型用法代码示例。如果您正苦于以下问题:Python Users.deleteUser方法的具体用法?Python Users.deleteUser怎么用?Python Users.deleteUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在users.Users的用法示例。


在下文中一共展示了Users.deleteUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from users import Users [as 别名]
# 或者: from users.Users import deleteUser [as 别名]

#.........这里部分代码省略.........
            if opt == '-h':
                print (usageStr)
                sys.exit()
            elif opt == '-d':
                print ("Deleting at end of run.")
                CLEANUP = True
            elif opt in ("-t", "--target"):
                URL = arg.lstrip()
            elif opt in ("-c", "--command"):
                COMMAND = arg
            else:
                COMMAND = "Run All"
        print ('[main] Target is:', URL)
        print ('[main] Command is:', COMMAND)


    else:
        print(usageStr)
        sys.exit(2)


    #Set up some booleans for processing flags and order of processing
    if "context" in COMMAND:
        print("[main] Run context command")
        CONTEXT = True
    elif "user" in COMMAND:
        print("[main] Run user command")
        USER = True
    elif "recording" in COMMAND:
        print("[main] Run recording command")
        RECORDING = True
    elif "session" in COMMAND:
        print("[main] Run session command")
        SESSION = True
    elif "authorize" in COMMAND:
        print("[main] Run authorization command")
        AUTH = True
    else:
        print("[main] Empty Command: Run All\n")
        ALL = True


    print ('\n[main] Acquiring auth token...\n')
    authorized_session = AuthToken(URL)
    authorized_session.setToken()
    print ('\n[main] Returned token: ' + authorized_session.getToken() + '\n')
    
    if not AUTH:
        #run commands in required order if running ALL
        if USER or ALL:
            user_object = Users(URL, authorized_session.getToken())
            #process user command
            print("\n[main] Run user command: " + ('ALL' if ALL else COMMAND) + '...')
            
            user_object.getUsers(authorized_session.getToken())
            user_object.createUser(authorized_session.getToken())
            user_object.patchUser(authorized_session.getToken())
            user_object.putUser(authorized_session.getToken())
            user_object.getUser(authorized_session.getToken())
            
        if SESSION or ALL:
            #process Sessions command
            print("\n[main] Run sessions command: " + ('ALL' if ALL else COMMAND) + '...')
            session_object = Sessions(URL, authorized_session.getToken())
            
            session_object.getSessions(authorized_session.getToken())
            session_object.createSession(authorized_session.getToken())
            session_object.patchSession(authorized_session.getToken())
            session_object.putSession(authorized_session.getToken())
            session_object.getSession(authorized_session.getToken())
            session_object.getInstances(authorized_session.getToken())
            session_object.enrollModerator(user_object.getUserId(),authorized_session.getToken())
            session_object.readModeratorUrl(authorized_session.getToken())
                
        if RECORDING or ALL:
            #process Recordings command
            print("\n[main] Run recording_object command: " + ('ALL' if ALL else COMMAND) + '...')
            recording_object = Recordings(URL, authorized_session.getToken())
            
            recording_object.getRecordings(authorized_session.getToken())

        if CONTEXT or ALL:
            #process course command
            print("\n[main] Run Context command: " + ('ALL' if ALL else COMMAND) + '...')
            context_object = Contexts(URL, authorized_session.getToken())
                            
            context_object.getContexts(authorized_session.getToken())

    #clean up if not using individual commands
    if ALL:
        print('\n[main] Completing Demo and deleting created objects...')
        #print ("[main] Deleting Session")
        session_object.deleteSession(authorized_session.getToken())
        print ("[main] Deleting User")
        user_object.deleteUser(authorized_session.getToken())
    else:
        print("\nRemember to delete created demo objects!")


    print("[main] Processing Complete")
开发者ID:blackboard,项目名称:BBDN-Collab-REST-Demo-Python,代码行数:104,代码来源:CollabRestDemo.py


注:本文中的users.Users.deleteUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。