BUG - Cannot Update Ad with Custom Pinterest SDK Client
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 48/100
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
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
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pinterest/pinterest-python-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
bug
pinterest/pinterest-python-sdk#144 · 1 assignee ·
-
AttributeError: 'BoardSection' object has no attribute '_generated_api_get_fn_args'May be free again @dfana01 claimed this 564 days ago, and no pull request is open. Openbug
pinterest/pinterest-python-sdk#130 · 1 assignee ·
-
BUG - SDK Client pin creation fails but endpoint is workingMay be free again @dfana01 claimed this 564 days ago, and no pull request is open. Openbug
pinterest/pinterest-python-sdk#128 · 1 comment · 1 assignee ·
All issues in pinterest/pinterest-python-sdk
Similar issues
-
jobs restart --verify: hotlane restart timeout (10s) shorter than its shutdown (~30s) → false exit 1Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
EtanHey/brainlayer#1072 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
_apply_doc_content: a cancel during the shielded image gather still sends the content batchUpdateOpenenhancement
Difficulty 2/5 Under an hour Newbie friendliness 80/100
khuisman/mcp-gee-sweet#904 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
CORE-HIST-005/006 multi-turn history tests send three different messages with the same messageIdOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
a2aproject/a2a-tck#248 ·