How to use the bingads.v12.internal.bulk.string_table._StringTable 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 / bulk_ad_group_dynamic_search_ad_target.py View on Github external
campaign_name=None,
                 ad_group_name=None,
                 status=None,
                 biddable_ad_group_criterion=None):
        super(BulkAdGroupDynamicSearchAdTarget, self).__init__()

        self._campaign_name = campaign_name
        self._ad_group_name = ad_group_name
        self._status = status
        self._biddable_ad_group_criterion = biddable_ad_group_criterion
        self._performance_data = None


    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.Status,
            field_to_csv=lambda c: c.status,
            csv_to_field=lambda c, v: setattr(c, 'status', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Id,
            field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.Id),
            csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'Id', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.AdGroupId),
            csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'AdGroupId', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Campaign,
            field_to_csv=lambda c: c.campaign_name,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_ad_group_product_partition.py View on Github external
_SimpleBulkMapping(
            header=_StringTable.TrackingTemplate,
            field_to_csv=lambda c: bulk_optional_str(c.ad_group_criterion.TrackingUrlTemplate, c.ad_group_criterion.Id)
            if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None,
            csv_to_field=lambda c, v: setattr(c.ad_group_criterion, 'TrackingUrlTemplate', v if v else None)
            if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None
        ),
        _SimpleBulkMapping(
            header=_StringTable.CustomParameter,
            field_to_csv=lambda c: field_to_csv_UrlCustomParameters(c.ad_group_criterion)
            if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None,
            csv_to_field=lambda c, v: csv_to_field_UrlCustomParameters(c.ad_group_criterion, v)
            if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None
        ),
        _SimpleBulkMapping(
            header=_StringTable.FinalUrlSuffix,
            field_to_csv=lambda c: bulk_optional_str(c.ad_group_criterion.FinalUrlSuffix, c.ad_group_criterion.Id) if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None ,
            csv_to_field=lambda c, v: setattr(c.ad_group_criterion, 'FinalUrlSuffix', v) if isinstance(c.ad_group_criterion, _BiddableAdGroupCriterion) else None
        )
    ]

    @property
    def ad_group_criterion(self):
        """ Defines an Ad Group Criterion """

        return self._ad_group_criterion

    @ad_group_criterion.setter
    def ad_group_criterion(self, ad_group_criterion):
        self._ad_group_criterion = ad_group_criterion

    @property
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_ads.py View on Github external
""" The Expanded Text Ad.

        see Expanded Text Ad at https://go.microsoft.com/fwlink/?linkid=846127.
        """

        return self._ad

    @expanded_text_ad.setter
    def expanded_text_ad(self, expanded_text_ad):
        if expanded_text_ad is not None and not isinstance(expanded_text_ad, ExpandedTextAd):
            raise ValueError('Not an instance of ExpandedTextAd')
        self._ad = expanded_text_ad

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.Text,
            field_to_csv=lambda c: c.expanded_text_ad.Text,
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'Text', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.TextPart2,
            field_to_csv=lambda c: bulk_optional_str(c.expanded_text_ad.TextPart2, c.expanded_text_ad.Id),
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'TextPart2', v if v else '')
        ),
        _SimpleBulkMapping(
            header=_StringTable.TitlePart1,
            field_to_csv=lambda c: c.expanded_text_ad.TitlePart1,
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'TitlePart1', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.TitlePart2,
            field_to_csv=lambda c: c.expanded_text_ad.TitlePart2,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / target_criterions / bulk_campaign_negative_location_criterion.py View on Github external
* :class:`.BulkOperation`
    * :class:`.BulkFileReader`
    * :class:`.BulkFileWriter`
    """

    def __init__(self,
                 negative_campaign_criterion=None,
                 campaign_name=None, ):
        super(BulkCampaignNegativeLocationCriterion, self).__init__()

        self._negative_campaign_criterion = negative_campaign_criterion
        self._campaign_name = campaign_name

    _MAPPINGS = [
        _SimpleBulkMapping(
            _StringTable.Status,
            field_to_csv=lambda c: bulk_str(c.negative_campaign_criterion.Status),
            csv_to_field=lambda c, v: setattr(c.negative_campaign_criterion, 'Status', v if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Id,
            field_to_csv=lambda c: bulk_str(c.negative_campaign_criterion.Id),
            csv_to_field=lambda c, v: setattr(c.negative_campaign_criterion, 'Id', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.negative_campaign_criterion.CampaignId),
            csv_to_field=lambda c, v: setattr(c.negative_campaign_criterion, 'CampaignId', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Campaign,
            field_to_csv=lambda c: c.campaign_name,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / ad_extensions / bulk_location_ad_extensions.py View on Github external
def location_ad_extension(self, value):
        self._ad_extension = value

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.BusinessName,
            field_to_csv=lambda c: c.location_ad_extension.CompanyName,
            csv_to_field=lambda c, v: setattr(c.location_ad_extension, 'CompanyName', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.PhoneNumber,
            field_to_csv=lambda c: bulk_optional_str(c.location_ad_extension.PhoneNumber, c.location_ad_extension.Id),
            csv_to_field=lambda c, v: setattr(c.location_ad_extension, 'PhoneNumber', v if v else '')
        ),
        _SimpleBulkMapping(
            header=_StringTable.GeoCodeStatus,
            field_to_csv=lambda c: bulk_str(c.location_ad_extension.GeoCodeStatus),
            csv_to_field=lambda c, v: setattr(c.location_ad_extension, 'GeoCodeStatus', v if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.AddressLine1,
            field_to_csv=lambda c: BulkLocationAdExtension.get_address_part(
                c,
                lambda x: x.StreetAddress
            ),
            csv_to_field=lambda c, v: BulkLocationAdExtension.set_address_part(
                c,
                lambda x: setattr(x, 'StreetAddress', v)
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.AddressLine2,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / target_criterions / bulk_ad_group_location_criterion.py View on Github external
_StringTable.Id,
            field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.Id),
            csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'Id', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.AdGroupId),
            csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'AdGroupId', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Campaign,
            field_to_csv=lambda c: c.campaign_name,
            csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
        ),
        _SimpleBulkMapping(
            _StringTable.AdGroup,
            field_to_csv=lambda c: c.ad_group_name,
            csv_to_field=lambda c, v: setattr(c, 'ad_group_name', v)
        ),
        _SimpleBulkMapping(
            _StringTable.BidAdjustment,
            field_to_csv=lambda c: field_to_csv_BidAdjustment(c.biddable_ad_group_criterion),
            csv_to_field=lambda c, v: csv_to_field_BidAdjustment(c.biddable_ad_group_criterion, float(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Target,
            field_to_csv=lambda c: field_to_csv_LocationTarget(c.biddable_ad_group_criterion),
            csv_to_field=lambda c, v: csv_to_field_LocationTarget(c.biddable_ad_group_criterion, int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.SubType,
            field_to_csv=lambda c: field_to_csv_LocationType(c.biddable_ad_group_criterion),
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / ad_extensions / common.py View on Github external
""" This abstract class provides properties that are shared by all bulk campaign ad extension association classes. """

    def __init__(self,
                 ad_extension_id_to_entity_id_association=None,
                 status=None,
                 editorial_status=None):
        super(_BulkCampaignAdExtensionAssociation, self).__init__(
            ad_extension_id_to_entity_id_association,
            status,
            editorial_status,
        )
        self._campaign_name = None

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.Campaign,
            field_to_csv=lambda c: c.campaign_name,
            csv_to_field=lambda c, v: setattr(c, '_campaign_name', v)
        )
    ]

    def process_mappings_from_row_values(self, row_values):
        super(_BulkCampaignAdExtensionAssociation, self).process_mappings_from_row_values(row_values)
        row_values.convert_to_entity(self, _BulkCampaignAdExtensionAssociation._MAPPINGS)

    @property
    def campaign_name(self):
        """ The name of the campaign containing the ad group that the ad extension is associated.

        Corresponds to the 'Campaign' field in the bulk file.

        :rtype: str
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / audiences / bulk_in_market_audience.py View on Github external
* :class:`.BulkOperation`
    * :class:`.BulkFileReader`
    * :class:`.BulkFileWriter`
    """

    def __init__(self,
                 in_market_audience=None,
                 status=None,):
        super(BulkInMarketAudience, self).__init__()

        self._in_market_audience = in_market_audience
        self._status = status

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.Status,
            field_to_csv=lambda c: c.status,
            csv_to_field=lambda c, v: setattr(c, 'status', v)
        ),
        _SimpleBulkMapping(
            _StringTable.Id,
            field_to_csv=lambda c: bulk_str(c.in_market_audience.Id),
            csv_to_field=lambda c, v: setattr(c.in_market_audience, 'Id', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.in_market_audience.ParentId),
            csv_to_field=lambda c, v: setattr(c.in_market_audience, 'ParentId', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Audience,
            field_to_csv=lambda c: bulk_str(c.in_market_audience.Name),
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_keyword.py View on Github external
c.keyword,
                'EditorialStatus',
                v if v else None
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.MatchType,
            field_to_csv=lambda c: bulk_str(c.keyword.MatchType),
            csv_to_field=lambda c, v: setattr(
                c.keyword,
                'MatchType',
                v if v else None
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.DestinationUrl,
            field_to_csv=lambda c: bulk_optional_str(c.keyword.DestinationUrl, c.keyword.Id),
            csv_to_field=lambda c, v: setattr(
                c.keyword,
                'DestinationUrl',
                v if v else None
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.Bid,
            field_to_csv=lambda c: keyword_bid_bulk_str(c.keyword.Bid, c.keyword.Id),
            csv_to_field=lambda c, v: setattr(
                c.keyword,
                'Bid',
                parse_keyword_bid(v)
            )
        ),
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_keyword.py View on Github external
c.keyword,
                'Param2',
                v if v else ''
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.Param3,
            field_to_csv=lambda c: bulk_optional_str(c.keyword.Param3, c.keyword.Id),
            csv_to_field=lambda c, v: setattr(
                c.keyword,
                'Param3',
                v if v else ''
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.FinalUrl,
            field_to_csv=lambda c: field_to_csv_Urls(c.keyword.FinalUrls, c.keyword.Id),
            csv_to_field=lambda c, v: csv_to_field_Urls(c.keyword.FinalUrls, v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.FinalMobileUrl,
            field_to_csv=lambda c: field_to_csv_Urls(c.keyword.FinalMobileUrls, c.keyword.Id),
            csv_to_field=lambda c, v: csv_to_field_Urls(c.keyword.FinalMobileUrls, v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.TrackingTemplate,
            field_to_csv=lambda c: bulk_str(c.keyword.TrackingUrlTemplate),
            csv_to_field=lambda c, v: setattr(c.keyword, 'TrackingUrlTemplate', v if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.CustomParameter,
            field_to_csv=lambda c: field_to_csv_UrlCustomParameters(c.keyword),