connection.py 文件源码

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

项目:QOpenScienceFramework 作者: dschreij 项目源码 文件源码
def create_session():
    """ Creates/resets and OAuth 2 session, with the specified data. """
    global session
    global settings

    try:
        client_id = settings['client_id']
        redirect_uri = settings['redirect_uri']
    except KeyError as e:
        raise KeyError("The OAuth2 settings dictionary is missing the {} entry. "
            "Please add it to the QOpenScienceFramework.connection.settings "
            "dicationary before trying to create a new session".format(e))

    # Set up requests_oauthlib object
    mobile_app_client = MobileApplicationClient(client_id)

    # Create an OAuth2 session for the OSF
    session = requests_oauthlib.OAuth2Session(
        client_id,
        mobile_app_client,
        scope=scope,
        redirect_uri=redirect_uri,
    )
    return session

# Generate correct URLs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号