How to use the bingads.service_client._CAMPAIGN_OBJECT_FACTORY_V12.create function in bingads

To help you get started, we’ve selected a few bingads examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / ad_extensions / bulk_location_ad_extensions.py View on Github external
def set_address_part(bulk_ad_extension, set_func):
        if bulk_ad_extension.location_ad_extension.Address is None:
            bulk_ad_extension.location_ad_extension.Address = _CAMPAIGN_OBJECT_FACTORY_V12.create('Address')
        set_func(bulk_ad_extension.location_ad_extension.Address)
github BingAds / BingAds-Python-SDK / bingads / v12 / internal / extensions.py View on Github external
def parse_fixed_bid(value):
    if not value:
        return None
    fixed_bid = _CAMPAIGN_OBJECT_FACTORY_V12.create('FixedBid')
    fixed_bid.Amount = float(value)
    return fixed_bid
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_ads.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self.responsive_search_ad = _CAMPAIGN_OBJECT_FACTORY_V12.create('ResponsiveSearchAd')
        self.responsive_search_ad.Type = 'ResponsiveSearch'
        super(BulkResponsiveSearchAd, self).process_mappings_from_row_values(row_values)
        row_values.convert_to_entity(self, BulkResponsiveSearchAd._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_ad_group_product_partition.py View on Github external
if is_excluded:
        product_partition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductPartition')
        product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductCondition')
        product_partition.Type = 'ProductPartition'

        negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('NegativeAdGroupCriterion')
        negative_ad_group_criterion.Criterion = product_partition
        negative_ad_group_criterion.Type = 'NegativeAdGroupCriterion'

        entity.ad_group_criterion = negative_ad_group_criterion
    else:
        product_partition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductPartition')
        product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductCondition')
        product_partition.Type = 'ProductPartition'

        bid = _CAMPAIGN_OBJECT_FACTORY_V12.create('FixedBid')
        bid.Type = 'FixedBid'

        biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableAdGroupCriterion')
        biddable_ad_group_criterion.Criterion = product_partition
        
        success, bid_value = row_values.try_get_value(_StringTable.Bid)
        if success and bid_value is not None and bid_value != '':
            bid.Amount = float(bid_value)
        else:
            success, bid_value = row_values.try_get_value(_StringTable.BidAdjustment)
            if success and bid_value is not None and bid_value != '':
                bid = _CAMPAIGN_OBJECT_FACTORY_V12.create('BidMultiplier')
                bid.Type = 'BidMultiplier'
                bid.Multiplier = float(bid_value)
            
        biddable_ad_group_criterion.CriterionBid = bid
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_ad_group_dynamic_search_ad_target.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self._biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableAdGroupCriterion')
        self._biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
        self._biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('Webpage')
        self._biddable_ad_group_criterion.Criterion.Type = 'Webpage'
        self._biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V12.create('FixedBid')
        self._biddable_ad_group_criterion.CriterionBid.Type = 'FixedBid'

        row_values.convert_to_entity(self, BulkAdGroupDynamicSearchAdTarget._MAPPINGS)

        self._performance_data = PerformanceData.read_from_row_values_or_null(row_values)
github BingAds / BingAds-Python-SDK / bingads / v12 / internal / extensions.py View on Github external
custom_param_pattern = "^\\{_(.*?)\\}=(.*$)"

BudgetLimitType = _CAMPAIGN_OBJECT_FACTORY_V12.create('BudgetLimitType')
DynamicSearchAdsSetting = _CAMPAIGN_OBJECT_FACTORY_V12.create('DynamicSearchAdsSetting')
Webpage = _CAMPAIGN_OBJECT_FACTORY_V12.create('Webpage')
WebpageConditionOperand = _CAMPAIGN_OBJECT_FACTORY_V12.create('WebpageConditionOperand')

RemarketingRule = _CAMPAIGN_OBJECT_FACTORY_V12.create('RemarketingRule')
PageVisitorsRule = _CAMPAIGN_OBJECT_FACTORY_V12.create('PageVisitorsRule')
PageVisitorsWhoVisitedAnotherPageRule = _CAMPAIGN_OBJECT_FACTORY_V12.create('PageVisitorsWhoVisitedAnotherPageRule')
PageVisitorsWhoDidNotVisitAnotherPageRule = _CAMPAIGN_OBJECT_FACTORY_V12.create('PageVisitorsWhoDidNotVisitAnotherPageRule')
CustomEventsRule = _CAMPAIGN_OBJECT_FACTORY_V12.create('CustomEventsRule')
StringOperator = _CAMPAIGN_OBJECT_FACTORY_V12.create('StringOperator')
NumberOperator = _CAMPAIGN_OBJECT_FACTORY_V12.create('NumberOperator')

AudienceCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('AudienceCriterion')
BidMultiplier = _CAMPAIGN_OBJECT_FACTORY_V12.create('BidMultiplier')

AgeCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('AgeCriterion')
DayTimeCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('DayTimeCriterion')
DeviceCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('DeviceCriterion')
GenderCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('GenderCriterion')
LocationCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('LocationCriterion')
LocationIntentCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('LocationIntentCriterion')
RadiusCriterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('RadiusCriterion')
TargetSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('TargetSetting'))
CoOpSetting_Type = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('CoOpSetting'))
TextAsset_Type = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('TextAsset'))
ImageAsset_Type = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('ImageAsset'))

def bulk_str(value):
    if value is None or (hasattr(value, 'value') and value.value is None):
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_ads.py View on Github external
from bingads.v12.bulk.entities import PerformanceData
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V12
from bingads.v12.internal.bulk.string_table import _StringTable
from bingads.v12.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v12.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v12.internal.extensions import *

# Define type used
ProductAd = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('ProductAd'))
TextAd = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('TextAd'))
AppInstallAd = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('AppInstallAd'))
ExpandedTextAd = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('ExpandedTextAd'))
DynamicSearchAd = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('DynamicSearchAd'))
ResponsiveSearchAd = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('ResponsiveSearchAd'))
ResponsiveAd = type(_CAMPAIGN_OBJECT_FACTORY_V12.create('ResponsiveAd'))


class _BulkAd(_SingleRecordBulkEntity):
    """ This abstract base class provides properties that are shared by all bulk ad classes.

    *See also:*

    * :class:`.BulkProductAd`
    * :class:`.BulkTextAd`
    * :class:`.BulkAppInstallAd`
github BingAds / BingAds-Python-SDK / bingads / v12 / internal / extensions.py View on Github external
def parse_date(d_str):
    if not d_str:
        return None
    parsed_date = datetime.strptime(d_str, _BULK_DATE_FORMAT)
    bing_ads_date = _CAMPAIGN_OBJECT_FACTORY_V12.create('Date')
    bing_ads_date.Day = parsed_date.day
    bing_ads_date.Month = parsed_date.month
    bing_ads_date.Year = parsed_date.year

    return bing_ads_date
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_campaign_product_scope.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self._biddable_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('BiddableCampaignCriterion')
        self._biddable_campaign_criterion.Type = 'BiddableCampaignCriterion'
        self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V12.create('ProductScope')
        self._biddable_campaign_criterion.Criterion.Type = 'ProductScope'

        row_values.convert_to_entity(self, BulkCampaignProductScope._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_campaign.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self._campaign = _CAMPAIGN_OBJECT_FACTORY_V12.create('Campaign')
        row_values.convert_to_entity(self, BulkCampaign._MAPPINGS)
        self._quality_score_data = QualityScoreData.read_from_row_values_or_null(row_values)
        self._performance_data = PerformanceData.read_from_row_values_or_null(row_values)