-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-generated python SDK code update
Summary: ignore-conflict-markers Reviewed By: liliarizona Differential Revision: D65913382 fbshipit-source-id: 88b3b91021357a46a40ebf5bfabc3d255c16f7dc
- Loading branch information
1 parent
ec46a30
commit 497f3ce
Showing
139 changed files
with
3,848 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
'name', | ||
] | ||
params = { | ||
} | ||
print AdAccount(id).get_ad_creatives( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'name': 'Sample Promoted Post', | ||
'object_story_id': '<pageID>_<postID>', | ||
} | ||
print AdAccount(id).create_ad_creative( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'object_story_id': '<pageID>_<postID>', | ||
} | ||
print AdAccount(id).create_ad_creative( | ||
fields=fields, | ||
params=params, | ||
) |
26 changes: 26 additions & 0 deletions
26
examples/AdAccountAdCreativesPostCreateAdCreativeCanvas.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'image_hash': '<imageHash>', | ||
'object_story_spec': {'page_id':'<pageID>','link_data':{'image_hash':'<imageHash>','link':'<canvasURI>','name':'Creative message','call_to_action':{'type':'LEARN_MORE'}}}, | ||
} | ||
print AdAccount(id).create_ad_creative( | ||
fields=fields, | ||
params=params, | ||
) |
26 changes: 26 additions & 0 deletions
26
examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasDV.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'object_story_spec': {'page_id':'<pageID>','template_data':{'format_option':'collection_video','link':'<canvasURI>','name':'English Creative title','message':'English Creative message','call_to_action':{'type':'LEARN_MORE'},'retailer_item_ids':[0,0,0,0],'customization_rules_spec':[{'customization_spec':{'language':'en_XX'}},{'customization_spec':{'language':'fr_XX'},'link':'<canvasURIFR>','name':'French Creative title','message':'French Creative message'}]}}, | ||
'product_set_id': '<productSetID>', | ||
} | ||
print AdAccount(id).create_ad_creative( | ||
fields=fields, | ||
params=params, | ||
) |
26 changes: 26 additions & 0 deletions
26
examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasImage.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'object_story_spec': {'page_id':'<pageID>','link_data':{'picture':'<imageURL>','link':'<canvasURI>','name':'English Creative title','message':'English Creative message','call_to_action':{'type':'LEARN_MORE'},'retailer_item_ids':[0,0,0,0],'customization_rules_spec':[{'customization_spec':{'language':'en_XX'}},{'customization_spec':{'language':'fr_XX'},'picture':'<imageURLFR>','link':'<canvasURIFR>','name':'French Creative title','message':'French Creative message'}]}}, | ||
'product_set_id': '<productSetID>', | ||
} | ||
print AdAccount(id).create_ad_creative( | ||
fields=fields, | ||
params=params, | ||
) |
26 changes: 26 additions & 0 deletions
26
examples/AdAccountAdCreativesPostCreateAdCreativeCustomizationCanvasVideo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'object_story_spec': {'page_id':'<pageID>','video_data':{'video_id':'<videoID>','image_url':'<imageURL>','title':'English Creative title','message':'English Creative message','call_to_action':{'type':'LEARN_MORE','value':{'link':'<canvasURI>'}},'retailer_item_ids':[0,0,0,0],'customization_rules_spec':[{'customization_spec':{'language':'en_XX'}},{'customization_spec':{'language':'fr_XX'},'video_id':'<videoIDFR>','picture':'<imageURLFR>','link':'<canvasURIFR>','name':'French Creative title','message':'French Creative message'}]}}, | ||
'product_set_id': '<productSetID>', | ||
} | ||
print AdAccount(id).create_ad_creative( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adcreative import AdCreative | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'name': 'Sample Promoted', | ||
'object_story_spec': {'page_id':'<pageID>','link_data':{'image_hash':'<imageHash>','link':'<imageURL>','message':'try it out'}}, | ||
'degrees_of_freedom_spec': {'creative_features_spec':'{\'standard_enhancements\':\'{\\\'enroll_status\\\':\\\'OPT_IN\\\'}\'}'}, | ||
'special_ad_categories': [], | ||
} | ||
print AdAccount(id).create_ad_creative( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adlabel import AdLabel | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'name': 'My Label', | ||
} | ||
print AdAccount(id).create_ad_label( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adset import AdSet | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
'name', | ||
'id', | ||
'status', | ||
] | ||
params = { | ||
} | ||
print AdAccount(id).get_ad_sets( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adset import AdSet | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'name': 'A CPA Ad Set', | ||
'campaign_id': '<adCampaignLinkClicksID>', | ||
'daily_budget': '5000', | ||
'start_time': '2024-07-27T00:47:13-0700', | ||
'end_time': '2024-08-03T00:47:13-0700', | ||
'billing_event': 'IMPRESSIONS', | ||
'optimization_goal': 'REACH', | ||
'bid_amount': '1000', | ||
'promoted_object': {'page_id':'<pageID>'}, | ||
'targeting': {'facebook_positions':['feed'],'geo_locations':{'countries':['US']}}, | ||
'user_os': 'iOS', | ||
'publisher_platforms': 'facebook', | ||
'device_platforms': 'mobile', | ||
} | ||
print AdAccount(id).create_ad_set( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adset import AdSet | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'name': 'A CPA Ad Set optimized for App Events', | ||
'campaign_id': '<adCampaignAppInstallsID>', | ||
'daily_budget': '300', | ||
'start_time': '2024-08-05T17:55:15-0700', | ||
'end_time': '2024-08-12T17:55:15-0700', | ||
'billing_event': 'IMPRESSIONS', | ||
'optimization_goal': 'OFFSITE_CONVERSIONS', | ||
'bid_amount': '100', | ||
'status': 'PAUSED', | ||
'promoted_object': {'application_id':'<appID>','object_store_url':'<appLink>','custom_event_type':'PURCHASE'}, | ||
'targeting': {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'user_os':['iOS']}, | ||
} | ||
print AdAccount(id).create_ad_set( | ||
fields=fields, | ||
params=params, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
|
||
# This source code is licensed under the license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
from facebook_business.adobjects.adaccount import AdAccount | ||
from facebook_business.adobjects.adset import AdSet | ||
from facebook_business.api import FacebookAdsApi | ||
|
||
access_token = '<ACCESS_TOKEN>' | ||
app_secret = '<APP_SECRET>' | ||
app_id = '<APP_ID>' | ||
id = '<AD_ACCOUNT_ID>' | ||
FacebookAdsApi.init(access_token=access_token) | ||
|
||
fields = [ | ||
] | ||
params = { | ||
'name': 'My AdSet', | ||
'optimization_goal': 'REACH', | ||
'billing_event': 'IMPRESSIONS', | ||
'bid_amount': '2', | ||
'daily_budget': '1000', | ||
'campaign_id': '<adCampaignConversionsID>', | ||
'targeting': {'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'behaviors':[{'id':6007101597783,'name':'Business Travelers'},{'id':6004386044572,'name':'Android Owners (All)'}]}, | ||
} | ||
print AdAccount(id).create_ad_set( | ||
fields=fields, | ||
params=params, | ||
) |
Oops, something went wrong.