Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

BUG - Cannot Update Ad with Custom Pinterest SDK Client

Open
#152 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Search for the Ad.update_fields entry point shown in the issue and trace its call to self._update. Reproduce an update using a custom Pinterest SDK Client, then verify that the client is not passed into AdUpdateRequest and that the update completes without authentication or type errors.

Written by the indexing model from the issue text.

Description

bug

Describe the bug

When using a custom Pinterest SDK Client, I am unable to make updates to an ad, ad group, or campaign

To Reproduce

Currently, I am using a custom Pinterest SDK Client to authenticate, meaning the default client is unauthenticated. The client is initialized successfully, and I am able to fetch an ad successfully using ad = Ad(account_id, ad_id, client=self.client). However, once I run ad.update_fields(status=new_status) this operation fails saying I am not authenticated.

I then attempted to use ad.update_fields(status=new_status, client=self.client), however this results in a type error. After doing some digging, this error seems to originate from this code block

def update_fields(self, **kwargs) -> bool:
    """
    Update Ad fields suing any arguments

    Returns:
        bool: If Ad fields were updated successfully
    """
    if "creative_type" in kwargs:
        kwargs["creative_type"] = CreativeType(kwargs["creative_type"])
    if "status" in kwargs:
        kwargs["status"] = EntityStatus(kwargs["status"])
    return self._update(
        params={
            "ad_account_id": self._ad_account_id,
            "ad_update_request": [
                AdUpdateRequest(
                    id=self._id,
                    **kwargs
                )
            ]
        },
        api=AdsApi,
        update_fn=AdsApi.ads_update,
        **kwargs
    )

as passing a client object in here causes it to be passed into both AdUpdateRequest and self._update due to the use of **kwargs. After cloning the repo and making a change to include client=None in the update_fields function definition and client=client in the self._update function parameters, the function works as expected.

Expected behavior

I should be able to update ad status with a custom Pinterest SDK Client

Screenshots

Image
Image

Additional Details (please complete the following information):

  • OS and Version: MacOS Sequoia Version 15.4.1
  • SDK Version: 0.2.4
Dominant language
Python
Stars
85
Forks
40
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pinterest/pinterest-python-sdk

All issues in pinterest/pinterest-python-sdk

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.