Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login code cleanup #81

Open
alejandrox1 opened this issue Nov 28, 2018 · 0 comments
Open

Login code cleanup #81

alejandrox1 opened this issue Nov 28, 2018 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@alejandrox1
Copy link
Contributor

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.

@alejandrox1 alejandrox1 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant