def get_response(args, config_dir): """Send the request and return a `request.Response`.""" ssl_version = None if args.ssl_version: ssl_version = SSL_VERSION_ARG_MAPPING[args.ssl_version] requests_session = get_requests_session(ssl_version) requests_session.max_redirects = args.max_redirects if not args.session and not args.session_read_only: kwargs = get_requests_kwargs(args) if args.debug: dump_request(kwargs) response = requests_session.request(**kwargs) else: response = sessions.get_response( requests_session=requests_session, args=args, config_dir=config_dir, session_name=args.session or args.session_read_only, read_only=bool(args.session_read_only), ) return response
def get_response( args: argparse.Namespace, config_dir: Path ) -> requests.Response: """Send the request and return a `request.Response`.""" ssl_version = None if args.ssl_version: ssl_version = SSL_VERSION_ARG_MAPPING[args.ssl_version] requests_session = build_requests_session( ssl_version=ssl_version, compress_arg=args.compress ) requests_session.max_redirects = args.max_redirects with max_headers(args.max_headers): if not args.session and not args.session_read_only: kwargs = make_requests_kwargs(args) if args.debug: dump_request(kwargs) response = requests_session.request(**kwargs) else: response = sessions.get_response( requests_session=requests_session, args=args, config_dir=config_dir, session_name=args.session or args.session_read_only, read_only=bool(args.session_read_only), ) return response
def get_response(args, config_dir): """Send the request and return a `request.Response`.""" url = args.url # Handle web-socket connection if url.startswith('ws://'): response = handle_ws(url, data=args.data) return response requests_session = get_requests_session() if not args.session and not args.session_read_only: kwargs = get_requests_kwargs(args) if args.debug: dump_request(kwargs) response = requests_session.request(**kwargs) else: response = sessions.get_response( requests_session=requests_session, args=args, config_dir=config_dir, session_name=args.session or args.session_read_only, read_only=bool(args.session_read_only), ) return response
def get_response(args, config_dir): """Send the request and return a `request.Response`.""" if not args.session and not args.session_read_only: requests_kwargs = get_requests_kwargs(args) if args.debug: dump_request(requests_kwargs) response = requests.request(**requests_kwargs) else: response = sessions.get_response( args=args, config_dir=config_dir, session_name=args.session or args.session_read_only, read_only=bool(args.session_read_only), ) return response