Closed navaneethkwalee closed 3 months ago
Was referring to https://developers.facebook.com/docs/marketing-api/reference/ad-image/ and it's outdated but got succeeded after looking at the SDK codebase:
import base64
file_path = "test1080.jpg"
with open(file_path, "rb") as image_file:
img_data = base64.b64encode(image_file.read()).decode('utf-8')
FacebookAdsApi.init(APP_ID, APP_SECRET, ACCESS_TOKEN, debug=True)
my_account = AdAccount(AD_ACCOUNT_ID)
resp = my_account.create_ad_image(
params={
'bytes': img_data,
}
)
print(resp)
I'm not find the documentation of this anywhere, please update it if it's the latest one.
thank you. we'll update the doc accordingly.
Code:
Error: