如何解决Python Google API Campaign Manager 插入创意资产显示成功,但未出现在广告客户中
我正在使用 Campaign Manager API 将本地文件上传到广告商;该脚本一直运行,没有任何错误。但是,当直接检查广告商时,没有新的创意资产。更改日志也没有显示任何新的更改。脚本运行(没有谷歌身份验证 - OAuth 2.0,它在其他调用上符合预期):
def upload_creative_asset(
service,profile_id,advertiser_id,asset_name,path_to_asset_file,asset_type):
"""Uploads a creative asset and returns an assetIdentifier."""
# Construct the creative asset metadata
creative_asset = {
'assetIdentifier': {
'name': asset_name,'type': asset_type
}
}
media = MediaFileUpload(path_to_asset_file,mimetype='image/gif')
if not media.mimetype():
media = MediaFileUpload(path_to_asset_file,'application/octet-stream')
response = service.creativeAssets().insert(
advertiserId=advertiser_id,profileId=profile_id,media_body=media,body=creative_asset)
return response
path_to_creative = "automated_dcm_loading/test.gif"
upload_creative_request = upload_creative_asset(service,advertiser_id='10229XXX',profile_id='6414XXX',asset_name='test.gif',path_to_asset_file=path_to_creative,asset_type='image')
upload_creative_request.execute()
回复是:
{'kind': 'dfareporting#creativeAssetMetadata','assetIdentifier': {'type': 'IMAGE','name': 'test.gif'},'id': '475828XXX','richMedia': False}
这告诉我它有效,但没有出现在活动管理器中的任何地方。
更新:这只是让资产出现在活动管理器中的一半过程。对于需要此功能的人,下一步是在 creatives().insert() 函数中使用此 exact 输出,用 creative 包装资产 em>。如果没有这个创造性的步骤,您的资产/图像/视频将位于服务器上的某个地方,无处可显示。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。