Repository: gradio-app/gradio
File: client/python/gradio_client/client.py (Python)

Code before:
        """
        Parameters:
            src: either the name of the Hugging Face Space to load, (e.g. "abidlabs/whisper-large-v2") or the full URL (including "http" or "https") of the hosted Gradio app to load (e.g. "http://mydomain.com/app" or "https://bec81a83-5b5c-471e.gradio.live/").
            hf_token: optional Hugging Face token to use to access private Spaces. By default, no token is sent to the server. Set `hf_token=None` to use the locally saved token if there is one (warning: only provide a token if you are loading a trusted private Space as the token can be read by the Space you are loading). Find your tokens here: https://huggingface.co/settings/tokens.
            max_workers: maximum number of thread workers that can be used to make requests to the remote Gradio app simultaneously.
            verbose: whether the client should print statements to the console.
            headers: additional headers to send to the remote Gradio app on every request. By default only the HF authorization and user-agent headers are sent. This parameter will override the default headers if they have the same keys.
            download_files: directory where the client should download output files  on the local machine from the remote API. By default, uses the value of the GRADIO_TEMP_DIR environment variable which, if not set by the user, is a temporary directory on your machine. If False, the client does not download files and returns a FileData dataclass object with the filepath on the remote machine instead.
            ssl_verify: if False, skips certificate validation which allows the client to connect to Gradio apps that are using self-signed certificates.
            httpx_kwargs: additional keyword arguments to pass to `httpx.Client`, `httpx.stream`, `httpx.get` and `httpx.post`. This can be used to set timeouts, proxies, http auth, etc.
            analytics_enabled: Whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable or default to True.
        """
        self.verbose = verbose
        self.hf_token = hf_token
        self.download_files = download_files
        self._skip_components = _skip_components
        self.headers = build_hf_headers(
            token=hf_token,
            library_name="gradio_client",
            library_version=utils.__version__,
        )
        if headers:
            self.headers.update(headers)
        self.ssl_verify = ssl_verify
        self.space_id = None
        self.cookies: dict[str, str] = dict(httpx_kwargs.get('cookies', {}))
        if isinstance(self.download_files, (str, Path)):
            if not os.path.exists(self.download_files):
                os.makedirs(self.download_files, exist_ok=True)
            if not os.path.isdir(self.download_files):
                raise ValueError(f"Path: {self.download_files} is not a directory.")
            self.output_dir = str(self.download_files)
        else:
            self.output_dir = DEFAULT_TEMP_DIR

        if src.startswith("http://") or src.startswith("https://"):
            _src = src if src.endswith("/") else src + "/"
        else:
            _src = self._space_name_to_src(src)
            if _src is None:
                raise ValueError(
                    f"Could not find Space: {src}. If it is a private Space, please provide an hf_token."
                )
            self.space_id = src
        self.src = _src
        state = self._get_space_state()
        if state == SpaceStage.BUILDING:
            if self.verbose:
                print("Space is still building. Please wait...")
            while self._get_space_state() == SpaceStage.BUILDING:
                time.sleep(2)  # so we don't get rate limited by the API

Review comment (suggestion):
I think you'll need to pop, otherwise will get an error later on when all the kwargs in `httpx_kwargs` are passed directly and also `cookies` is passed as an explicit parameter
```suggestion
        self.cookies: dict[str, str] = dict(httpx_kwargs.pop('cookies', {}))
```

Code after:
        """
        Parameters:
            src: either the name of the Hugging Face Space to load, (e.g. "abidlabs/whisper-large-v2") or the full URL (including "http" or "https") of the hosted Gradio app to load (e.g. "http://mydomain.com/app" or "https://bec81a83-5b5c-471e.gradio.live/").
            hf_token: optional Hugging Face token to use to access private Spaces. By default, no token is sent to the server. Set `hf_token=None` to use the locally saved token if there is one (warning: only provide a token if you are loading a trusted private Space as the token can be read by the Space you are loading). Find your tokens here: https://huggingface.co/settings/tokens.
            max_workers: maximum number of thread workers that can be used to make requests to the remote Gradio app simultaneously.
            verbose: whether the client should print statements to the console.
            headers: additional headers to send to the remote Gradio app on every request. By default only the HF authorization and user-agent headers are sent. This parameter will override the default headers if they have the same keys.
            download_files: directory where the client should download output files  on the local machine from the remote API. By default, uses the value of the GRADIO_TEMP_DIR environment variable which, if not set by the user, is a temporary directory on your machine. If False, the client does not download files and returns a FileData dataclass object with the filepath on the remote machine instead.
            ssl_verify: if False, skips certificate validation which allows the client to connect to Gradio apps that are using self-signed certificates.
            httpx_kwargs: additional keyword arguments to pass to `httpx.Client`, `httpx.stream`, `httpx.get` and `httpx.post`. This can be used to set timeouts, proxies, http auth, etc.
            analytics_enabled: Whether to allow basic telemetry. If None, will use GRADIO_ANALYTICS_ENABLED environment variable or default to True.
        """
        self.verbose = verbose
        self.hf_token = hf_token
        self.download_files = download_files
        self._skip_components = _skip_components
        self.headers = build_hf_headers(
            token=hf_token,
            library_name="gradio_client",
            library_version=utils.__version__,
        )
        if headers:
            self.headers.update(headers)
        self.ssl_verify = ssl_verify
        self.space_id = None
        self.httpx_kwargs = {} if httpx_kwargs is None else httpx_kwargs
        self.cookies: dict[str, str] = dict(
            (self.httpx_kwargs.pop("cookies", {})) or {}
        )
        if isinstance(self.download_files, (str, Path)):
            if not os.path.exists(self.download_files):
                os.makedirs(self.download_files, exist_ok=True)
            if not os.path.isdir(self.download_files):
                raise ValueError(f"Path: {self.download_files} is not a directory.")
            self.output_dir = str(self.download_files)
        else:
            self.output_dir = DEFAULT_TEMP_DIR

        if src.startswith("http://") or src.startswith("https://"):
            _src = src if src.endswith("/") else src + "/"
        else:
            _src = self._space_name_to_src(src)
            if _src is None:
                raise ValueError(
                    f"Could not find Space: {src}. If it is a private Space, please provide an hf_token."
                )
            self.space_id = src
        self.src = _src
        state = self._get_space_state()
        if state == SpaceStage.BUILDING:
            if self.verbose: