|
@@ -6,7 +6,8 @@ import sys
|
|
|
import tooncher
|
|
|
import yaml
|
|
|
|
|
|
-def run(username, config_path, engine_path = None):
|
|
|
+
|
|
|
+def run(username, config_path, engine_path=None, validate_ssl_certs=True):
|
|
|
|
|
|
if os.path.exists(config_path):
|
|
|
with open(config_path) as f:
|
|
@@ -14,9 +15,9 @@ def run(username, config_path, engine_path = None):
|
|
|
else:
|
|
|
config = {}
|
|
|
|
|
|
- if engine_path is None:
|
|
|
- engine_path = config['engine_path'] if 'engine_path' in config else None
|
|
|
- if engine_path is None:
|
|
|
+ if engine_path is None and 'engine_path' in config:
|
|
|
+ engine_path = config['engine_path']
|
|
|
+ else:
|
|
|
raise Exception('missing path to toontown engine')
|
|
|
|
|
|
accounts = config['accounts'] if 'accounts' in config else []
|
|
@@ -24,26 +25,36 @@ def run(username, config_path, engine_path = None):
|
|
|
for account in accounts:
|
|
|
if account['username'] == username:
|
|
|
tooncher.launch(
|
|
|
- engine_path = engine_path,
|
|
|
- username = account['username'],
|
|
|
- password = account['password'],
|
|
|
- )
|
|
|
+ engine_path=engine_path,
|
|
|
+ username=account['username'],
|
|
|
+ password=account['password'],
|
|
|
+ validate_ssl_certs=validate_ssl_certs,
|
|
|
+ )
|
|
|
+
|
|
|
|
|
|
def _init_argparser():
|
|
|
|
|
|
import argparse
|
|
|
- argparser = argparse.ArgumentParser(description = None)
|
|
|
+ argparser = argparse.ArgumentParser(description=None)
|
|
|
argparser.add_argument('username')
|
|
|
argparser.add_argument(
|
|
|
'--config',
|
|
|
'-c',
|
|
|
- metavar = 'path',
|
|
|
- dest = 'config_path',
|
|
|
- help = 'path to config file (default: %(default)s)',
|
|
|
- default = os.path.join(os.path.expanduser('~'), '.tooncher'),
|
|
|
- )
|
|
|
+ metavar='path',
|
|
|
+ dest='config_path',
|
|
|
+ help='path to config file (default: %(default)s)',
|
|
|
+ default=os.path.join(os.path.expanduser('~'), '.tooncher'),
|
|
|
+ )
|
|
|
+ argparser.add_argument(
|
|
|
+ '--no-ssl-cert-validation',
|
|
|
+ '-k',
|
|
|
+ dest='validate_ssl_certs',
|
|
|
+ help='do not validate ssl certificates',
|
|
|
+ action='store_false',
|
|
|
+ )
|
|
|
return argparser
|
|
|
|
|
|
+
|
|
|
def main(argv):
|
|
|
|
|
|
argparser = _init_argparser()
|