Last 12 weeks · 1 commit
5 of 6 standards met
What does this PR do? Adds a robust wrapper () to handle the that occurs when sending events with in the Facebook Python Business SDK. If the API response is missing , the wrapper returns a safe fallback EventResponse, preventing crashes. No core SDK files are changed; this is a drop-in, non-breaking fix. Includes a test script to verify the patch. Why is this needed? When using , the Facebook API sometimes omits the field, causing the SDK to raise a and crash. This patch ensures robust handling of this scenario. How to use ```python from facebook_business.utils.safe_serverside import SafeEventRequestAsync request = SafeEventRequestAsync(events=[event], pixel_id=pixel_id) response = await request.execute()
Hello 😊 Description I am experiencing a persistent connection error when trying to remove users from a CustomAudience using the method. The error message is: This error consistently occurs when the batch size (the number of users in the users list) is 300 or more. When I use an identical call with a batch size of 250, the operation succeeds every time. Impact This limitation is a significant bottleneck for our use case. We need to remove large volumes of users from audiences (up to 4 million users at a time). With a maximum successful batch size of 250, an operation of this scale takes well over 24 hours to complete, which is not feasible for our daily data pipelines. We need to be able to send larger, more efficient batches (ideally 5,000-10,000 as documented for ) to complete the operation in a reasonable timeframe. I would be happy to hear any suggestions on how we might increase the batch size without running into this connection issue, or if there is any other method you recommend to help us speed up the removal of a large number of users. Simply increasing parallelism with the small 250-user batch size is not our ideal goal, especially since we are restricted in the number of parallel tasks we can run in our environment. Versions SDK Version: API Version: Thank you very much for looking into this! 🙂
Repository: facebook/facebook-python-business-sdk. Description: Python SDK for Meta Marketing APIs Stars: 1499, Forks: 668. Primary language: Python. Languages: Python (100%). Homepage: https://developers.facebook.com/docs/business-sdk Latest release: 24.0.1 (3mo ago). Open PRs: 18, open issues: 41. Last activity: 2w ago. Community health: 75%. Top contributors: jingping2015, marksliva, satwikareddy3, stcheng, neilxchen, kongxinzhu, agriffis, neilsh, HeyMultiverse, archanl and others.
Everything is working well for us with this SDK, except that we encounter a bug every time we try to set the action source as . Changing all the other fields doesn't produce this problem and we can see events coming through correctly. Given a setup like this: And then a function that does this: That last lines fails with Again, it seems like none of the data we're including matters except for the . If it's then this will work correctly without an error every time. Looking at that line of code here: https://github.com/facebook/facebook-python-business-sdk/blob/main/facebook_business/adobjects/serverside/event_request_async.py#L99 It seems like it's making some assumptions about what's included in the response, when maybe it should be more careful?
Considering that the SDK seems to heavily rely on dynamically retyping objects at runtime, it would be great if stub files could be published along side. Otherwise using this package within projects that rely on type checkers pretty much results in having to ignore type errors everywhere as actual return types completely differ from signatures.
I’m trying to publish multi-language ads on Meta. I’m sending the asset_feed_spec in this format, but I need to specify the publisher_platforms (either Facebook or Instagram) and also the corresponding facebook_positions and instagram_positions. How can I do that? I’ve tried several solutions, such as adding placements separately for each language, but none of them worked.
I am getting this error - We think that someone may have tried to access your account without permission. For your protection, you won't be able to create or modify ads until you've authenticated your account in Ads Manager. Your existing ads will continue to run normally. Even though I have launched manually from ads manager and its working fine, I am not prompted to authenticate my account. After that also, it is not working, is there anyone facing the same issue?