## Install the Python client library

To install the Python client library in your local environment:

1. Extract the Python client library tarball.
2. Run the following command in the same directory:

   ```python
   python -m pip install .
   ```
3. Follow the prompts in the terminal to complete the installation.

> [!NOTE]
> **Note:** Don't use `python setup.py` to install the Python client library. It may cause dependency issues.

## Configuration using YAML file

You can specify a YAML file to use when initializing the client that contains
the necessary authentication information needed to make requests. This file is
accessed when a client is initialized using the `load_from_file` method.
Follow the [example provided below](https://developers.google.com/search-ads/reporting/client-libraries/python-config.md.txt#yaml-example) when creating the YAML file
to specify the
[refresh token](https://cloud.google.com/docs/authentication/token-types#refresh-tokens),
client ID, and client secret.

> [!NOTE]
> **Note:** You can generate an OAuth refresh token by running the provided [user credential generation script](https://developers.google.com/search-ads/reporting/sample-code/generate-user-credentials.md.txt "user credential generation script") or by using the [OAuth Playground](https://developers.google.com/search-ads/reporting/concepts/oauth-playground.md.txt) utility.

To specify the location where the `search-ads-360.yaml` file is located, you can
pass the path as a string to the method when calling it:

```python
from util_searchads360 import SearchAds360Client
client = SearchAds360Client.load_from_file("path/to/search-ads-360.yaml")
```

If you don't provide a path, the library looks in your `$HOME` directory for
the file:

```python
from util_searchads360 import SearchAds360Client
client = SearchAds360Client.load_from_file()
```

### Configuration Fields

The client library configuration supports the following fields.

General fields:

- `refresh_token`: Your OAuth refresh token.
- `client_id`: Your OAuth client ID.
- `client_secret`: Your OAuth client secret.
- `login_customer_id`: See the [login-customer-id documentation](https://developers.google.com/search-ads/reporting/concepts/login-customer-id.md.txt).

### Supported keys for desktop and web application flows

If you are using the [desktop or web](https://developers.google.com/search-ads/reporting/quickstart/quickstart-guide.md.txt#create_oauth2_credentials)
application flow, the supported keys are as follows:

```bash
# 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
```