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
评论列表
文章目录