cli.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:osfclient 作者: osfclient 项目源码 文件源码
def _setup_osf(args):
    # Command line options have precedence over environment variables,
    # which have precedence over the config file.
    config = config_from_env(config_from_file())

    username = _get_username(args, config)

    project = config.get('project')
    if args.project is None:
        args.project = project
    # still None? We are in trouble
    if args.project is None:
        sys.exit('You have to specify a project ID via the command line,'
                 ' configuration file or environment variable.')

    password = None
    if username is not None:
        password = os.getenv("OSF_PASSWORD")

        # Prompt user when password is not set
        if password is None:
            password = getpass.getpass('Please input your password: ')

    return OSF(username=username, password=password)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号