If you need to connect to the Google Ads API through an HTTP or HTTPS proxy, you can
configure the `http_proxy` setting in your configuration file, programmatically,
or through an environment variable. The `http_proxy` setting applies to the
underlying gRPC transport channel used by the Python client library.

## Configure using `google-ads.yaml`

Specify the `http_proxy` setting in your [`google-ads.yaml`](https://github.com/googleads/google-ads-python/blob/HEAD/google-ads.yaml) file:

    # Optional proxy configuration used for API requests. If your proxy does not
    # require authentication, specify only the host and port.
    http_proxy: INSERT_PROXY_HERE

For example, you can specify `http://user:pass@localhost:8082` as a proxy.

> [!CAUTION]
> **Caution:** Avoid committing plain-text proxy credentials to version control. Use environment variables for sensitive proxy credentials in production environments.

## Configure programmatically

You can also configure the proxy setting programmatically using the
`GoogleAdsClient` initialization methods (`load_from_dict`, `load_from_env`, and
`load_from_string`), just like any other configuration setting:

    from google.ads.googleads.client import GoogleAdsClient

    config = {
        # Include other required configuration settings here.
        "http_proxy": "INSERT_PROXY_HERE",
    }
    googleads_client = GoogleAdsClient.load_from_dict(config)

## Configure using environment variables

To configure a proxy with the `load_from_env` method, set the
`GOOGLE_ADS_HTTP_PROXY` environment variable:

    export GOOGLE_ADS_HTTP_PROXY="http://user:pass@localhost:8082"