Mercurial > repos > gga > apollo_create_account
comparison create_account.py @ 6:83f07a884301 draft
planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/apollo commit 85194fa009ead2c34720faab61a4143fc29d17c2
| author | gga |
|---|---|
| date | Fri, 31 Aug 2018 09:32:04 -0400 |
| parents | 9e7b56138937 |
| children | a5388eab6383 |
comparison
equal
deleted
inserted
replaced
| 5:9e7b56138937 | 6:83f07a884301 |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 from __future__ import print_function | 2 from __future__ import print_function |
| 3 | 3 |
| 4 import argparse | 4 import argparse |
| 5 import random | |
| 6 import time | 5 import time |
| 7 | 6 |
| 8 from six.moves.builtins import str | 7 from six.moves.builtins import str |
| 9 | 8 |
| 10 from webapollo import WAAuth, WebApolloInstance | 9 from webapollo import PasswordGenerator, WAAuth, WebApolloInstance |
| 11 | |
| 12 | |
| 13 def pwgen(length): | |
| 14 chars = list('qwrtpsdfghjklzxcvbnm') | |
| 15 return ''.join(random.choice(chars) for _ in range(length)) | |
| 16 | 10 |
| 17 | 11 |
| 18 if __name__ == '__main__': | 12 if __name__ == '__main__': |
| 19 parser = argparse.ArgumentParser(description='Sample script to add an account via web services') | 13 parser = argparse.ArgumentParser(description='Sample script to add an account via web services') |
| 20 WAAuth(parser) | 14 WAAuth(parser) |
| 24 parser.add_argument('--last', help='Last Name', default='Aggie') | 18 parser.add_argument('--last', help='Last Name', default='Aggie') |
| 25 args = parser.parse_args() | 19 args = parser.parse_args() |
| 26 | 20 |
| 27 wa = WebApolloInstance(args.apollo, args.username, args.password) | 21 wa = WebApolloInstance(args.apollo, args.username, args.password) |
| 28 | 22 |
| 29 password = pwgen(12) | 23 password = PasswordGenerator(12) |
| 30 time.sleep(1) | 24 time.sleep(1) |
| 31 users = wa.users.loadUsers() | 25 users = wa.users.loadUsers() |
| 32 user = [u for u in users | 26 user = [u for u in users |
| 33 if u.username == args.email] | 27 if u.username == args.email] |
| 34 | 28 |
