2020-04-01 08:21:44 -04:00
|
|
|
#!/usr/bin/env python3
|
2013-12-09 16:26:10 -05:00
|
|
|
|
2017-07-26 23:09:28 -02:30
|
|
|
import argparse
|
2013-12-09 16:26:10 -05:00
|
|
|
|
|
|
|
usage = """create-user --new-email=<email address> --new-password=<password> --new-full-name=<full name> --new-short-name=<short name> [options]
|
|
|
|
|
|
|
|
Create a user. You must be a realm admin to use this API, and the user
|
|
|
|
will be created in your realm.
|
|
|
|
|
2017-08-25 11:03:06 +02:00
|
|
|
Example: create-user --new-email=jarthur@example.com --new-password=random17 --new-full-name 'J. Arthur Random' --new-short-name='jarthur'
|
|
|
|
|
|
|
|
Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options.
|
2013-12-09 16:26:10 -05:00
|
|
|
"""
|
|
|
|
|
|
|
|
import zulip
|
|
|
|
|
2017-07-26 23:09:28 -02:30
|
|
|
parser = zulip.add_default_arguments(argparse.ArgumentParser(usage=usage))
|
2018-05-14 21:15:16 +02:00
|
|
|
parser.add_argument('--new-email', required=True)
|
|
|
|
parser.add_argument('--new-password', required=True)
|
|
|
|
parser.add_argument('--new-full-name', required=True)
|
|
|
|
parser.add_argument('--new-short-name', required=True)
|
2017-07-26 23:09:28 -02:30
|
|
|
options = parser.parse_args()
|
2013-12-09 16:26:10 -05:00
|
|
|
|
|
|
|
client = zulip.init_from_options(options)
|
|
|
|
|
2016-03-10 21:45:34 +05:30
|
|
|
print(client.create_user({
|
2017-01-23 22:06:13 -08:00
|
|
|
'email': options.new_email,
|
|
|
|
'password': options.new_password,
|
|
|
|
'full_name': options.new_full_name,
|
|
|
|
'short_name': options.new_short_name
|
2017-01-23 21:34:26 -08:00
|
|
|
}))
|