How to use the bingads.service_client._CAMPAIGN_OBJECT_FACTORY_V11.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 / v11 / internal / extensions.py View on Github external
def csv_to_field_BidStrategyType(entity, value):
    """
    set BiddingScheme
    :param entity: entity which has BiddingScheme attribute
    :param value: the content in csv
    :return:
    """
    if value is None or value == '':
        return
    elif value == 'EnhancedCpc':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V11.create('EnhancedCpcBiddingScheme')
    elif value == 'InheritFromParent':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V11.create('InheritFromParentBiddingScheme')
    elif value == 'MaxConversions':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V11.create('MaxConversionsBiddingScheme')
    elif value == 'ManualCpc':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V11.create('ManualCpcBiddingScheme')
    elif value == 'TargetCpa':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V11.create('TargetCpaBiddingScheme')
    elif value == 'MaxClicks':
        entity.BiddingScheme = _CAMPAIGN_OBJECT_FACTORY_V11.create('MaxClicksBiddingScheme')
    else:
        raise ValueError('Unknown Bid Strategy Type')
    entity.BiddingScheme.Type = value
github BingAds / BingAds-Python-SDK / bingads / v11 / internal / extensions.py View on Github external
def csv_to_entity_DSAWebpageParameter(row_values, entity):
    """
    convert Campaign/Ad Group Criterion (WebpagePage) Web page parameters to bulk row values
    :param row_values: bulk row values
    :param entity: campaign/ad group criterion entity
    """
    MAX_NUMBER_OF_CONDITIONS = 3
    condition_prefix = _StringTable.DynamicAdTargetCondition1[:-1]
    value_prefix = _StringTable.DynamicAdTargetValue1[:-1]

    conditions = []
    for i in range(0, MAX_NUMBER_OF_CONDITIONS):
        condition_success, webpage_condition = row_values.try_get_value(condition_prefix + str(i + 1))
        value_success, webpage_value = row_values.try_get_value(value_prefix + str(i + 1))
        if condition_success and value_success and webpage_condition is not None and webpage_condition != '':
            condition = _CAMPAIGN_OBJECT_FACTORY_V11.create('ns0:WebpageCondition')
            if webpage_condition.lower() == 'url':
                condition.Operand = WebpageConditionOperand.Url
            elif webpage_condition.lower() == "category":
                condition.Operand = WebpageConditionOperand.Category
            elif webpage_condition.lower() == 'pagetitle':
                condition.Operand = WebpageConditionOperand.PageTitle
            elif webpage_condition.lower() == 'pagecontent':
                condition.Operand = WebpageConditionOperand.PageContent
            else:
                # TODO wait bug 54825 to be fixed
                if webpage_condition.lower() == 'none':
                    continue
                raise ValueError("Unknown WebpageConditionOperand value: {0}".format(webpage_condition))

            condition.Argument = webpage_value
            conditions.append(condition)
github BingAds / BingAds-Python-SDK / bingads / v11 / bulk / entities / ad_extensions / bulk_location_ad_extensions.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self.location_ad_extension = _CAMPAIGN_OBJECT_FACTORY_V11.create('LocationAdExtension')
        self.location_ad_extension.Type = 'LocationAdExtension'
        if row_values[_StringTable.Latitude] or row_values[_StringTable.Longitude]:
            self.location_ad_extension.GeoPoint = _CAMPAIGN_OBJECT_FACTORY_V11.create('GeoPoint')
        super(BulkLocationAdExtension, self).process_mappings_from_row_values(row_values)
        row_values.convert_to_entity(self, BulkLocationAdExtension._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v11 / bulk / entities / target_criterions / bulk_ad_group_device_criterion.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self._biddable_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('BiddableAdGroupCriterion')
        self._biddable_ad_group_criterion.Type = 'BiddableAdGroupCriterion'
        self._biddable_ad_group_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('DeviceCriterion')
        self._biddable_ad_group_criterion.Criterion.Type = 'DeviceCriterion'
        self._biddable_ad_group_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V11.create('BidMultiplier')
        self._biddable_ad_group_criterion.CriterionBid.Type = 'BidMultiplier'
        row_values.convert_to_entity(self, BulkAdGroupDeviceCriterion._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v11 / bulk / entities / target_criterions / bulk_campaign_age_criterion.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self._biddable_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('BiddableCampaignCriterion')
        self._biddable_campaign_criterion.Type = 'BiddableCampaignCriterion'
        self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('AgeCriterion')
        self._biddable_campaign_criterion.Criterion.Type = 'AgeCriterion'
        self._biddable_campaign_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V11.create('BidMultiplier')
        self._biddable_campaign_criterion.CriterionBid.Type = 'BidMultiplier'
        row_values.convert_to_entity(self, BulkCampaignAgeCriterion._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v11 / internal / extensions.py View on Github external
def parse_rule_PageVisitors(rule_str):
    rule = _CAMPAIGN_OBJECT_FACTORY_V11.create('ns0:PageVisitorsRule')
    rule.Type = 'PageVisitors'
    rule.RuleItemGroups = parse_rule_groups(rule_str)
    return rule
github BingAds / BingAds-Python-SDK / bingads / v11 / internal / extensions.py View on Github external
from six import PY2
import re
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V11, _CAMPAIGN_MANAGEMENT_SERVICE_V11

target_setting_detail_pattern="^(Age|Audience|CompanyName|Gender|Industry|JobFunction)$"

DELETE_VALUE = "delete_value"
_BULK_DATETIME_FORMAT = '%m/%d/%Y %H:%M:%S'
_BULK_DATETIME_FORMAT_2 = '%m/%d/%Y %H:%M:%S.%f'
_BULK_DATE_FORMAT = "%m/%d/%Y"

url_splitter = ";\\s*(?=https?://)"
custom_param_splitter = "(?
github BingAds / BingAds-Python-SDK / bingads / v11 / bulk / entities / target_criterions / bulk_campaign_radius_criterion.py View on Github external
def process_mappings_from_row_values(self, row_values):
        self._biddable_campaign_criterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('BiddableCampaignCriterion')
        self._biddable_campaign_criterion.Type = 'BiddableCampaignCriterion'
        self._biddable_campaign_criterion.Criterion = _CAMPAIGN_OBJECT_FACTORY_V11.create('RadiusCriterion')
        self._biddable_campaign_criterion.Criterion.Type = 'RadiusCriterion'
        self._biddable_campaign_criterion.CriterionBid = _CAMPAIGN_OBJECT_FACTORY_V11.create('BidMultiplier')
        self._biddable_campaign_criterion.CriterionBid.Type = 'BidMultiplier'
        row_values.convert_to_entity(self, BulkCampaignRadiusCriterion._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v11 / bulk / entities / bulk_ad_group_product_partition.py View on Github external
def _read_is_excluded(cls, entity, row_value):
        if row_value is None:
            row_value = ''
        row_value = row_value.lower()
        if row_value == 'yes' or row_value == 'true':
            is_excluded = True
        elif row_value == 'no' or row_value == 'false':
            is_excluded = False
        else:
            raise ValueError('IsExcluded can only be set to TRUE|FALSE in Ad Group Product Partition row')
        if is_excluded:
            product_partition = _CAMPAIGN_OBJECT_FACTORY_V11.create('ProductPartition')
            product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V11.create('ProductCondition')
            product_partition.Type = 'ProductPartition'

            negative_ad_group_criterion = _CAMPAIGN_OBJECT_FACTORY_V11.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_V11.create('ProductPartition')
            product_partition.Condition = _CAMPAIGN_OBJECT_FACTORY_V11.create('ProductCondition')
            product_partition.Type = 'ProductPartition'

            fixed_bid = _CAMPAIGN_OBJECT_FACTORY_V11.create('FixedBid')
            fixed_bid.Type = 'FixedBid'