# Credential for accessing Google's OAuth servers.# Provided by console.cloud.google.com.
client_id:INSERT_CLIENT_ID_HERE
# Credential for accessing Google's OAuth servers.# Provided by console.cloud.google.com.
client_secret:INSERT_CLIENT_SECRET_HERE
# Renewable OAuth credential associated with 1 or more Search Ads accounts.
refresh_token:INSERT_REFRESH_TOKEN_HERE
# Required for manager accounts only: Specify the login customer ID used to# authenticate API calls. This will be the customer ID of the authenticated# manager account. You can also specify this later in code if your application# uses multiple manager account + OAuth pairs.## login_customer_id: INSERT_LOGIN_CUSTOMER_ID_HERE
[null,null,["最后更新时间 (UTC):2025-09-03。"],[[["\u003cp\u003eInstall the Python client library using \u003ccode\u003epython -m pip install .\u003c/code\u003e after extracting the tarball, avoiding \u003ccode\u003epython setup.py\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eConfigure authentication using a YAML file containing refresh token, client ID, client secret, and optionally, login customer ID.\u003c/p\u003e\n"],["\u003cp\u003eInitialize the client by specifying the YAML file path using \u003ccode\u003eSearchAds360Client.load_from_file()\u003c/code\u003e, which defaults to your \u003ccode\u003e$HOME\u003c/code\u003e directory if no path is provided.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration supports general fields like \u003ccode\u003erefresh_token\u003c/code\u003e, \u003ccode\u003eclient_id\u003c/code\u003e, \u003ccode\u003eclient_secret\u003c/code\u003e, and \u003ccode\u003elogin_customer_id\u003c/code\u003e for authentication and account access.\u003c/p\u003e\n"],["\u003cp\u003eDesktop and web application flows use specific keys like \u003ccode\u003eclient_id\u003c/code\u003e, \u003ccode\u003eclient_secret\u003c/code\u003e, \u003ccode\u003erefresh_token\u003c/code\u003e, and optionally, \u003ccode\u003elogin_customer_id\u003c/code\u003e within the YAML file.\u003c/p\u003e\n"]]],["To install the Python client library, extract the tarball and run `python -m pip install .`. Avoid using `python setup.py`. Configure the client using a YAML file, specifying `refresh_token`, `client_id`, and `client_secret`. Load the configuration with `load_from_file`, providing a file path or letting the library check the `$HOME` directory. Additional fields like `login_customer_id` are supported. Web application flows need the `client_id`, `client_secret`, and `refresh_token` keys.\n"],null,["# Python client library configuration\n\nInstall the Python client library\n---------------------------------\n\nTo install the Python client library in your local environment:\n\n1. Extract the Python client library tarball.\n2. Run the following command in the same directory:\n\n python -m pip install .\n\n3. Follow the prompts in the terminal to complete the installation.\n\n| **Note:** Don't use `python setup.py` to install the Python client library. It may cause dependency issues.\n\nConfiguration using YAML file\n-----------------------------\n\nYou can specify a YAML file to use when initializing the client that contains\nthe necessary authentication information needed to make requests. This file is\naccessed when a client is initialized using the `load_from_file` method.\nFollow the [example provided below](#yaml-example) when creating the YAML file\nto specify the [refresh\ntoken](https://cloud.google.com/docs/authentication/token-types#refresh), client\nID, and client secret.\n| **Note:** You can generate an OAuth refresh token by running the provided [user credential generation script](/search-ads/reporting/sample-code/generate-user-credentials \"user credential generation script\") or by using the [OAuth Playground](/search-ads/reporting/concepts/oauth-playground) utility.\n\nTo specify the location where the `search-ads-360.yaml` file is located, you can\npass the path as a string to the method when calling it: \n\n from util_searchads360 import SearchAds360Client\n client = SearchAds360Client.load_from_file(\"path/to/search-ads-360.yaml\")\n\nIf you don't provide a path, the library looks in your `$HOME` directory for\nthe file: \n\n from util_searchads360 import SearchAds360Client\n client = SearchAds360Client.load_from_file()\n\n### Configuration Fields\n\nThe client library configuration supports the following fields.\n\nGeneral fields:\n\n- `refresh_token`: Your OAuth refresh token.\n- `client_id`: Your OAuth client ID.\n- `client_secret`: Your OAuth client secret.\n- `login_customer_id`: See the [login-customer-id documentation](/search-ads/reporting/concepts/login-customer-id).\n\n### Supported keys for desktop and web application flows\n\nIf you are using the [desktop or web](/search-ads/reporting/quickstart/quickstart-guide#create_oauth2_credentials)\napplication flow, the supported keys are as follows: \n\n # Credential for accessing Google's OAuth servers.\n # Provided by console.cloud.google.com.\n client_id: INSERT_CLIENT_ID_HERE\n\n # Credential for accessing Google's OAuth servers.\n # Provided by console.cloud.google.com.\n client_secret: INSERT_CLIENT_SECRET_HERE\n\n # Renewable OAuth credential associated with 1 or more Search Ads accounts.\n refresh_token: INSERT_REFRESH_TOKEN_HERE\n\n # Required for manager accounts only: Specify the login customer ID used to\n # authenticate API calls. This will be the customer ID of the authenticated\n # manager account. You can also specify this later in code if your application\n # uses multiple manager account + OAuth pairs.\n #\n # login_customer_id: INSERT_LOGIN_CUSTOMER_ID_HERE"]]