api: Add support for specifying client using zulip.init_from_options.
(imported from commit f92db44af606d67d5a1dcc9c978cee0d079d466d)
This commit is contained in:
parent
fab71363f4
commit
6f4fd336cd
|
@ -59,12 +59,16 @@ def generate_option_group(parser):
|
||||||
group.add_option('-v', '--verbose',
|
group.add_option('-v', '--verbose',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Provide detailed output.')
|
help='Provide detailed output.')
|
||||||
|
group.add_option('--client',
|
||||||
|
action='store',
|
||||||
|
default="API: Python",
|
||||||
|
help=optparse.SUPPRESS_HELP)
|
||||||
|
|
||||||
return group
|
return group
|
||||||
|
|
||||||
def init_from_options(options):
|
def init_from_options(options):
|
||||||
return Client(email=options.email, api_key=options.api_key, config_file=options.config_file,
|
return Client(email=options.email, api_key=options.api_key, config_file=options.config_file,
|
||||||
verbose=options.verbose, site=options.site)
|
verbose=options.verbose, site=options.site, client=options.client)
|
||||||
|
|
||||||
class Client(object):
|
class Client(object):
|
||||||
def __init__(self, email=None, api_key=None, config_file=None,
|
def __init__(self, email=None, api_key=None, config_file=None,
|
||||||
|
|
Loading…
Reference in a new issue