Mercurial > repos > gga > apollo_fetch_jbrowse
diff create_account.py @ 10:dca2fb399ee6 draft
"planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 08015be1ee8a784e0619f961aaa724857debfd6f"
author | gga |
---|---|
date | Mon, 02 Dec 2019 05:45:36 -0500 |
parents | 1a2976c6b161 |
children |
line wrap: on
line diff
--- a/create_account.py Mon Jul 29 10:09:38 2019 -0400 +++ b/create_account.py Mon Dec 02 05:45:36 2019 -0500 @@ -4,35 +4,30 @@ import argparse import time -from six.moves.builtins import str - -from webapollo import PasswordGenerator, WAAuth, WebApolloInstance +from arrow.apollo import get_apollo_instance if __name__ == '__main__': parser = argparse.ArgumentParser(description='Sample script to add an account via web services') - WAAuth(parser) - parser.add_argument('email', help='User Email') parser.add_argument('--first', help='First Name', default='Jane') parser.add_argument('--last', help='Last Name', default='Aggie') args = parser.parse_args() - wa = WebApolloInstance(args.apollo, args.username, args.password) + wa = get_apollo_instance() - password = PasswordGenerator(12) + password = wa.users._password_generator(12) time.sleep(1) - users = wa.users.loadUsers() + users = wa.users.get_users() user = [u for u in users - if u.username == args.email] + if u['username'] == args.email] if len(user) == 1: # Update name, regen password if the user ran it again - userObj = user[0] - returnData = wa.users.updateUser(userObj, args.email, args.first, args.last, password) + returnData = wa.users.update_user(args.email, args.first, args.last, password) print('Updated User\nUsername: %s\nPassword: %s' % (args.email, password)) else: - returnData = wa.users.createUser(args.email, args.first, args.last, password, role='user') + returnData = wa.users.create_user(args.email, args.first, args.last, password, role='user') print('Created User\nUsername: %s\nPassword: %s' % (args.email, password)) print("Return data: " + str(returnData))