Skip to content

Login code cleanup #81

@alejandrox1

Description

@alejandrox1

Is your feature request related to a problem? Please describe.
The majority of scripts will check if a user already has an access token or create it for the user.
The code that does this is repeated throughout the place. i.e.,

agave-cli/bin/files-cp

Lines 49 to 60 in db55abb

agave = Agave()
config_file = "{}/config.json".format(cache_dir)
# Check if there is a session already saved.
if os.path.exists(config_file):
agave.load_configs(cache_dir=cache_dir)
else:
print("You need to initiate a session first. Use auth-sessions-init")
sys.exit(1)
# Refresh tokens if necessary.
agave.refresh_tokens()

Describe the solution you'd like
This could all very well be organized into a function, login(), that all other scripts can import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions