We recommend using the
[Google API client libraries](https://developers.google.com/api-client-library) to set
up the Content API for Shopping. This guide uses the Python Content API client
libraries as an example, but they're available for many popular programming
languages and simplify common API tasks like authentication, sending requests,
and parsing responses. For help setting up client libraries for
other languages, see the **README.md** for the language within the
[googleads/googleads-shopping-samples](https://github.com/googleads/googleads-shopping-samples)
repo on GitHub.

> [!NOTE]
> **Note:** You need to install several required libraries to use the sample code in Python. For this reason, we recommend creating a Python virtual environment before you proceed. For more information, see [Installing packages using pip and virtual environments](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).

To set up the Google API client library for Python, complete the following steps:

1. Create a directory for the client library's configuration and authentication
   files. Within your home directory, create the following directories:

   **\~/shopping-samples/content/**

   > [!NOTE]
   > **Note:** This path, as well as the filename for the **merchant-info.json** file created in step 5, are defined in the **python/shopping/content/common.py** file within the Content API samples directory downloaded in step 7.

2. To download your service account credentials, complete the following steps:

   1. Go to the [Google API library](https://console.cloud.google.com/apis/library).
   2. Select a project in the menu at the top of the page. If you don't have one yet, create one by clicking **New project**.
   3. If you haven't already enabled the Content API for Shopping for this project, then search for it in the list of Google APIs and enable it.
   4. Click the navigation menu (☰) in the top left, select **APIs \& Services** , and then select **Credentials**.
   5. To set up a service account, select **Create credentials** , and then **Service account**.
   6. Name the new service account. This also serves as the default username for the service account ID. Record the service account ID, including the part after the '@' character, for later use. Click **Create** , then go through the optional steps of granting access to project and users, and click **Done**.
   7. You will be directed to the Service Accounts page where your new service account can be accessed.
3. To obtain a JSON private key, click the service account, then the **Keys**
   tab. Click **Add key** \> **Create new key** , and then select JSON as the
   key type. Click **Create** to download the private key to your computer.
   The new key downloads automatically.

4. Rename the downloaded credentials file to **service-account.json**.

   > [!NOTE]
   > **Note:** This filename is defined in the **_constants.py** file, which is located in **python/shopping/content/** within the Content API samples directory downloaded in step 7.

5. Move the **service-account.json** file to your
   **<var translate="no">home directory</var>/shopping-samples/content/**.

6. In your **<var translate="no">home directory</var>/shopping-samples/content/** , create an
   empty **merchant-info.json** file.

7. In **merchant-info.json**, add the following text:

       {
       "merchantId": your Merchant Center merchant ID,
       "accountSampleUser": "the email address associated with your Merchant Center account"
       }

8. Add the new service account as a user to your Merchant Center account. If you
   are a third-party developer, you will need to have your client do this step
   for you.

   1. Go to your [Merchant Center account](https://merchants.google.com).
   2. In the settings of your Merchant Center account, select **People and
      access**.
   3. Click **+ Add person** and use the service account ID as the email address
      for the new user.

      > [!NOTE]
      > **Note:** If you did not take note of the service account ID earlier, go to the [Service Accounts administration
      > page](https://console.developers.google.com/iam-admin/serviceaccounts) and select the project you created.

   4. The use of the `Accounts` service requires Admin access, so select
      **Admin**.

   5. Click **Add user** to save preferences and be returned to the list of
      users. The service account ID is listed with the chosen user role.

   6. Repeat the process for all other service accounts you want to add.

9. Clone (or download and unzip) the
   [googleads/googleads-shopping-samples](https://github.com/googleads/googleads-shopping-samples)
   GitHub repo to any location on your computer; it does not have to be in your
   home directory or in **\~/shopping-samples/content/**.

10. If you downloaded and unzipped the repo, instead of cloning it, rename the
    unzipped directory to **googleads-shopping-samples**.

11. To install the required sample dependencies, in a terminal window,
    navigate to **googleads-shopping-samples/python/** and run:

        pip install -r requirements.txt

You now have the Google API client library for Python configured and ready to use with the Content API. In the next section, you'll create and send a request to insert a new product.