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


Python Users.createUser方法代码示例

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


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

示例1: main

# 需要导入模块: from users import Users [as 别名]
# 或者: from users.Users import createUser [as 别名]
def main(argv):
    URL = "https://xx-csa.bbcollab.com"
    
    COMMAND = ''
    ALL = False
    AUTH = False
    SESSION = False
    RECORDING = False
    CONTEXT = False
    USER = False
    CLEANUP = False

    usageStr = "\nCollabRestDemo.py -t|--target <target root URL> -c|--command <command>\n"
    usageStr += "e.g CollabRestDemo.py -t www.collabserver.com -c authorize."

    if len(sys.argv) > 1: #there are command line arguments
        try:
            opts, args = getopt.getopt(argv,"ht:c:",["target=","command="])
        except getopt.GetoptError:
            print (usageStr)
            sys.exit(2)
        for opt, arg in opts:
            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())
#.........这里部分代码省略.........
开发者ID:blackboard,项目名称:BBDN-Collab-REST-Demo-Python,代码行数:103,代码来源:CollabRestDemo.py


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