當前位置: 首頁>>代碼示例>>Python>>正文


Python AdSet.remote_read方法代碼示例

本文整理匯總了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
開發者ID:prwelber,項目名稱:fb_marketing_api_practice,代碼行數:9,代碼來源:adsets_practice.py

示例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)
開發者ID:mixi-adtech,項目名稱:facebook-tool,代碼行數:48,代碼來源:copy_ad_set_below.py

示例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]
開發者ID:dud3,項目名稱:facebook-python-ads-sdk,代碼行數:32,代碼來源:ADSET_READ_DATA_FORMAT.py

示例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
開發者ID:govind1246,項目名稱:python-flask-dokku-app,代碼行數:7,代碼來源:sample_main.py

示例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]
開發者ID:dud3,項目名稱:facebook-python-ads-sdk,代碼行數:32,代碼來源:ADSET_READ_SCHEDULE.py

示例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]
開發者ID:dud3,項目名稱:facebook-python-ads-sdk,代碼行數:32,代碼來源:ADSET_READ.py

示例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
開發者ID:mixi-adtech,項目名稱:facebook-tool,代碼行數:102,代碼來源:select.py


注:本文中的facebookads.objects.AdSet.remote_read方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。