def get_common_options(options): stickycookie, stickyauth = None, None if options.stickycookie_filt: stickycookie = options.stickycookie_filt if options.stickyauth_filt: stickyauth = options.stickyauth_filt stream_large_bodies = utils.parse_size(options.stream_large_bodies) reps = [] for i in options.replace: try: p = parse_replace_hook(i) except ParseException as e: raise configargparse.ArgumentTypeError(e.message) reps.append(p) for i in options.replace_file: try: patt, rex, path = parse_replace_hook(i) except ParseException as e: raise configargparse.ArgumentTypeError(e.message) try: v = open(path, "rb").read() except IOError as e: raise configargparse.ArgumentTypeError( "Could not read replace file: %s" % path) reps.append((patt, rex, v)) setheaders = [] for i in options.setheader: try: p = parse_setheader(i) except ParseException as e: raise configargparse.ArgumentTypeError(e.message) setheaders.append(p) return dict( app=options.app, app_host=options.app_host, app_port=options.app_port, anticache=options.anticache, anticomp=options.anticomp, client_replay=options.client_replay, kill=options.kill, no_server=options.no_server, refresh_server_playback=not options.norefresh, rheaders=options.rheaders, rfile=options.rfile, replacements=reps, setheaders=setheaders, server_replay=options.server_replay, scripts=options.scripts, stickycookie=stickycookie, stickyauth=stickyauth, stream_large_bodies=stream_large_bodies, showhost=options.showhost, outfile=options.outfile, verbosity=options.verbose, nopop=options.nopop, replay_ignore_content=options.replay_ignore_content, replay_ignore_params=options.replay_ignore_params, replay_ignore_payload_params=options.replay_ignore_payload_params, replay_ignore_host=options.replay_ignore_host)
def get_common_options(options): stickycookie, stickyauth = None, None if options.stickycookie_filt: stickycookie = options.stickycookie_filt if options.stickyauth_filt: stickyauth = options.stickyauth_filt stream_large_bodies = utils.parse_size(options.stream_large_bodies) reps = [] for i in options.replace: try: p = parse_replace_hook(i) except ParseException as e: raise configargparse.ArgumentTypeError(e.message) reps.append(p) for i in options.replace_file: try: patt, rex, path = parse_replace_hook(i) except ParseException as e: raise configargparse.ArgumentTypeError(e.message) try: v = open(path, "rb").read() except IOError as e: raise configargparse.ArgumentTypeError( "Could not read replace file: %s" % path ) reps.append((patt, rex, v)) setheaders = [] for i in options.setheader: try: p = parse_setheader(i) except ParseException as e: raise configargparse.ArgumentTypeError(e.message) setheaders.append(p) return dict( app=options.app, app_host=options.app_host, app_port=options.app_port, anticache=options.anticache, anticomp=options.anticomp, client_replay=options.client_replay, kill=options.kill, no_server=options.no_server, refresh_server_playback=not options.norefresh, rheaders=options.rheaders, rfile=options.rfile, replacements=reps, setheaders=setheaders, server_replay=options.server_replay, scripts=options.scripts, stickycookie=stickycookie, stickyauth=stickyauth, stream_large_bodies=stream_large_bodies, showhost=options.showhost, outfile=options.outfile, verbosity=options.verbose, nopop=options.nopop, replay_ignore_content=options.replay_ignore_content, replay_ignore_params=options.replay_ignore_params, replay_ignore_payload_params=options.replay_ignore_payload_params, replay_ignore_host=options.replay_ignore_host )