本文整理汇总了Python中facebookads.objects.AdSet.remote_read方法的典型用法代码示例。如果您正苦于以下问题:Python AdSet.remote_read方法的具体用法?Python AdSet.remote_read怎么用?Python AdSet.remote_read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类facebookads.objects.AdSet
的用法示例。
在下文中一共展示了AdSet.remote_read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_adsets
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import remote_read [as 别名]
def get_adsets(adset_id):
adset = AdSet(adset_id)
fields = [
AdSet.Field.name,
]
adset.remote_read(fields=fields)
return adset
示例2: copy
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import remote_read [as 别名]
def copy(self):
store_url = config['link_url'][self.param['account']][self.param['os']]
link_url = store_url.replace('https://', 'http://')
campaign = AdCampaign(self.param['campaign_id'])
campaign.remote_read(
fields=[
AdCampaign.Field.name
]
)
adset = AdSet(self.param['adset_id'])
adset.remote_read(
fields=[
AdSet.Field.name,
AdSet.Field.daily_budget,
AdSet.Field.pacing_type,
AdSet.Field.promoted_object,
AdSet.Field.targeting,
AdSet.Field.is_autobid,
AdSet.Field.billing_event,
AdSet.Field.optimization_goal,
AdSet.Field.bid_amount,
AdSet.Field.rtb_flag
]
)
# pp.pprint(adset)
adgroups = adset.get_ad_groups(
fields=[
AdGroup.Field.name,
AdGroup.Field.creative,
AdGroup.Field.tracking_specs,
AdGroup.Field.status
],
params={
AdGroup.Field.status: ['ACTIVE']
}
)
# pp.pprint(adgroups)
object_store_url = adset['promoted_object']['object_store_url']
replace_url = object_store_url.replace('https://', 'http://')
if link_url != replace_url:
return self.different_os_copy(campaign, adset, adgroups)
else:
return self.same_os_copy(campaign, adset, adgroups)
示例3: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import remote_read [as 别名]
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
from examples.docs import fixtures
ad_set_id = fixtures.create_adset().get_id_assured()
# !_DOC [duliomatos]
# _DOC open [ADSET_READ_DATA_FORMAT]
# _DOC vars [ad_set_id]
from facebookads.objects import AdSet
adset = AdSet(fbid=ad_set_id)
fields = [
AdSet.Field.start_time,
AdSet.Field.end_time,
AdSet.Field.configured_status,
AdSet.Field.effective_status,
AdSet.Field.campaign_id,
]
params = {
'date_format': 'U',
}
adset.remote_read(fields=fields, params=params)
print(adset[AdSet.Field.effective_status])
# _DOC close [ADSET_READ_DATA_FORMAT]
示例4: read_adset
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import remote_read [as 别名]
def read_adset(id):
adset = AdSet(id)
adset.remote_read(fields=[AdSet.Field.account_id,AdSet.Field.adlabels,AdSet.Field.adset_schedule,AdSet.Field.bid_amount,AdSet.Field.bid_info,AdSet.Field.billing_event,AdSet.Field.budget_remaining,AdSet.Field.campaign,AdSet.Field.campaign_id,AdSet.Field.configured_status,AdSet.Field.created_time,AdSet.Field.creative_sequence,AdSet.Field.daily_budget,AdSet.Field.effective_status,AdSet.Field.end_time,AdSet.Field.frequency_cap,AdSet.Field.frequency_cap_reset_period,AdSet.Field.frequency_control_specs,AdSet.Field.id,AdSet.Field.is_autobid,AdSet.Field.lifetime_budget,AdSet.Field.lifetime_frequency_cap,AdSet.Field.lifetime_imps,AdSet.Field.name,AdSet.Field.optimization_goal,AdSet.Field.pacing_type,AdSet.Field.promoted_object,AdSet.Field.recommendations,AdSet.Field.rf_prediction_id,AdSet.Field.rtb_flag,AdSet.Field.start_time,AdSet.Field.status,AdSet.Field.targeting,AdSet.Field.updated_time])
print(adset)
return adset
示例5: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import remote_read [as 别名]
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Facebook platform, your use
# of this software is subject to the Facebook Developer Principles and
# Policies [http://developers.facebook.com/policy/]. This copyright notice
# shall be included in all copies or substantial portions of the software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
from examples.docs import fixtures
ad_set_id = fixtures.create_adset().get_id_assured()
# !_DOC [pruno]
# _DOC open [ADSET_READ_SCHEDULE]
# _DOC vars [ad_set_id]
from facebookads.objects import AdSet
adset = AdSet(fbid=ad_set_id)
adset.remote_read(fields=[AdSet.Field.adset_schedule])
# _DOC close [ADSET_READ_SCHEDULE]
示例6: AdSet
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import remote_read [as 别名]
# shall be included in all copies or substantial portions of the software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
from examples.docs import fixtures
ad_set_id = fixtures.create_adset().get_id_assured()
# !_DOC [duliomatos]
# _DOC open [ADSET_READ]
# _DOC vars [ad_set_id]
from facebookads.objects import AdSet
adset = AdSet(fbid=ad_set_id)
fields = [
AdSet.Field.name,
AdSet.Field.configured_status,
AdSet.Field.effective_status,
]
adset.remote_read(fields=fields)
print(adset[AdSet.Field.name])
print(adset[AdSet.Field.configured_status])
print(adset[AdSet.Field.effective_status])
# _DOC close [ADSET_READ]
示例7: select_target
# 需要导入模块: from facebookads.objects import AdSet [as 别名]
# 或者: from facebookads.objects.AdSet import remote_read [as 别名]
def select_target(self):
parent_id = config['act_id'][self.param['account']]
account = AdAccount(parent_id)
campaigns = account.get_ad_campaigns(
fields=[
AdCampaign.Field.name,
AdCampaign.Field.status
],
params={
'campaign_group_status': ['ACTIVE']
}
)
adset = AdSet(self.param['adset_id'])
adset.remote_read(
fields=[
AdSet.Field.name,
AdSet.Field.targeting,
AdSet.Field.campaign_group_id,
]
)
# pp.pprint(adset)
if(('genders' in adset['targeting']) and
(len(adset['targeting']['genders']) == 1)):
gender = adset['targeting']['genders'][0]
else:
gender = 0
for i in range(0, len(campaigns)):
campaign = campaigns[i]
if adset['campaign_group_id'] == campaign['id']:
campaign_name = campaign['name']
break
country_list = []
for country in COUNTRY_CODES:
is_checked = 0
if (country in adset['targeting']['geo_locations']['countries']):
is_checked = 1
countries = {
'name': country,
'is_checked': is_checked
}
country_list.append(countries)
custom_audiences = account.get_custom_audiences(
fields=[
CustomAudience.Field.name,
],
params={'limit': 1000}
)
audience_list = []
for i in range(0, len(custom_audiences)):
audience = custom_audiences[i]
is_checked = 0
if('custom_audiences' in adset['targeting']):
for default_audience in adset['targeting']['custom_audiences']:
if (audience['id'] == default_audience['id']):
is_checked = 1
break
audiences = {
'name': audience['name'],
'id': audience['id'],
'is_checked': is_checked,
}
audience_list.append(audiences)
excluded_list = []
for i in range(0, len(custom_audiences)):
audience = custom_audiences[i]
is_checked = 0
if('excluded_custom_audiences' in adset['targeting']):
excluded = adset['targeting']['excluded_custom_audiences']
for default_excluded in excluded:
if (audience['id'] == default_excluded['id']):
is_checked = 1
break
excludeds = {
'name': audience['name'],
'id': audience['id'],
'is_checked': is_checked,
}
excluded_list.append(excludeds)
result = {
'account': self.param['account'],
'adset': adset,
'campaigns': campaigns,
'gender': gender,
'age_range': AGE_RANGE,
'campaign_name': campaign_name,
'country_list': country_list,
'audience_list': audience_list,
'excluded_list': excluded_list,
}
return result