How to use the bingads.v12.internal.bulk.mappings._SimpleBulkMapping 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 / target_criterions / bulk_ad_group_radius_criterion.py View on Github external
_SimpleBulkMapping(
            _StringTable.Radius,
            field_to_csv=lambda c: field_to_csv_Radius(c.biddable_ad_group_criterion),
            csv_to_field=lambda c, v: csv_to_field_Radius(c.biddable_ad_group_criterion, int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Unit,
            field_to_csv=lambda c: field_to_csv_RadiusUnit(c.biddable_ad_group_criterion),
            csv_to_field=lambda c, v: csv_to_field_RadiusUnit(c.biddable_ad_group_criterion, v)
        ),
        _SimpleBulkMapping(
            _StringTable.Latitude,
            field_to_csv=lambda c: field_to_csv_LatitudeDegrees(c.biddable_ad_group_criterion),
            csv_to_field=lambda c, v: csv_to_field_LatitudeDegrees(c.biddable_ad_group_criterion, float(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Longitude,
            field_to_csv=lambda c: field_to_csv_LongitudeDegrees(c.biddable_ad_group_criterion),
            csv_to_field=lambda c, v: csv_to_field_LongitudeDegrees(c.biddable_ad_group_criterion, float(v) if v else None)
        ),
    ]

    @property
    def biddable_ad_group_criterion(self):
        """ Defines a Ad Group Criterion """

        return self._biddable_ad_group_criterion

    @biddable_ad_group_criterion.setter
    def biddable_ad_group_criterion(self, biddable_ad_group_criterion):
        self._biddable_ad_group_criterion = biddable_ad_group_criterion
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / audiences / bulk_in_market_audience.py View on Github external
_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),
            csv_to_field=lambda c, v: setattr(c.in_market_audience, 'Name', v)
        ),
        _SimpleBulkMapping(
            _StringTable.Description,
            field_to_csv=lambda c: bulk_str(c.in_market_audience.Description),
            csv_to_field=lambda c, v: setattr(c.in_market_audience, 'Description', v)
        ),
        _SimpleBulkMapping(
            _StringTable.MembershipDuration,
            field_to_csv=lambda c: bulk_str(c.in_market_audience.MembershipDuration),
            csv_to_field=lambda c, v: setattr(c.in_market_audience, 'MembershipDuration', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Scope,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / target_criterions / bulk_campaign_radius_criterion.py View on Github external
_SimpleBulkMapping(
            _StringTable.Status,
            field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.Status),
            csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'Status', v if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Id,
            field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.Id),
            csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'Id', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.CampaignId),
            csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'CampaignId', 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.BidAdjustment,
            field_to_csv=lambda c: field_to_csv_BidAdjustment(c.biddable_campaign_criterion),
            csv_to_field=lambda c, v: csv_to_field_BidAdjustment(c.biddable_campaign_criterion, float(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Name,
            field_to_csv=lambda c: field_to_csv_RadiusName(c.biddable_campaign_criterion),
            csv_to_field=lambda c, v: csv_to_field_RadiusName(c.biddable_campaign_criterion, v)
        ),
        _SimpleBulkMapping(
            _StringTable.Radius,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / bulk_campaign.py View on Github external
_ComplexBulkMapping(budget_to_csv, csv_to_budget),
        _SimpleBulkMapping(
            header=_StringTable.BidAdjustment,
            field_to_csv=lambda c: bulk_str(c.campaign.AudienceAdsBidAdjustment),
            csv_to_field=lambda c, v: setattr(
                c.campaign,
                'AudienceAdsBidAdjustment',
                int(v) if v else None
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.BingMerchantCenterId,
            field_to_csv=lambda c: BulkCampaign._write_store_id(c),
            csv_to_field=lambda c, v: BulkCampaign._read_store_id(c, v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.CampaignPriority,
            field_to_csv=lambda c: BulkCampaign._write_priority(c),
            csv_to_field=lambda c, v: BulkCampaign._read_priority(c, v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.CountryCode,
            field_to_csv=lambda c: BulkCampaign._write_sales_country_code(c),
            csv_to_field=lambda c, v: BulkCampaign._read_sales_country_code(c, v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.LocalInventoryAdsEnabled,
            field_to_csv=lambda c: BulkCampaign._write_local_inventory_ads_enabled(c),
            csv_to_field=lambda c, v: BulkCampaign._read_local_inventory_ads_enabled(c, v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.TrackingTemplate,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / audiences / bulk_custom_audience.py View on Github external
def __init__(self,
                 custom_audience=None,
                 status=None,):
        super(BulkCustomAudience, self).__init__()

        self._custom_audience = custom_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.custom_audience.Id),
            csv_to_field=lambda c, v: setattr(c.custom_audience, 'Id', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.custom_audience.ParentId),
            csv_to_field=lambda c, v: setattr(c.custom_audience, 'ParentId', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Audience,
            field_to_csv=lambda c: bulk_str(c.custom_audience.Name),
            csv_to_field=lambda c, v: setattr(c.custom_audience, 'Name', v)
        ),
        _SimpleBulkMapping(
            _StringTable.Description,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / target_criterions / bulk_campaign_location_criterion.py View on Github external
_SimpleBulkMapping(
            _StringTable.BidAdjustment,
            field_to_csv=lambda c: field_to_csv_BidAdjustment(c.biddable_campaign_criterion),
            csv_to_field=lambda c, v: csv_to_field_BidAdjustment(c.biddable_campaign_criterion, float(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.Target,
            field_to_csv=lambda c: field_to_csv_LocationTarget(c.biddable_campaign_criterion),
            csv_to_field=lambda c, v: csv_to_field_LocationTarget(c.biddable_campaign_criterion, int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.SubType,
            field_to_csv=lambda c: field_to_csv_LocationType(c.biddable_campaign_criterion),
            csv_to_field=lambda c, v: csv_to_field_LocationType(c.biddable_campaign_criterion, v)
        ),
        _SimpleBulkMapping(
            _StringTable.Name,
            field_to_csv=lambda c: field_to_csv_LocationName(c.biddable_campaign_criterion),
            csv_to_field=lambda c, v: csv_to_field_LocationName(c.biddable_campaign_criterion, v)
        ),
    ]

    @property
    def biddable_campaign_criterion(self):
        """ Defines a Campaign Criterion """

        return self._biddable_campaign_criterion

    @biddable_campaign_criterion.setter
    def biddable_campaign_criterion(self, biddable_campaign_criterion):
        self._biddable_campaign_criterion = biddable_campaign_criterion
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / ad_extensions / bulk_location_ad_extensions.py View on Github external
field_to_csv=lambda c: BulkLocationAdExtension.get_address_part(c, lambda x: x.PostalCode),
            csv_to_field=lambda c, v: BulkLocationAdExtension.set_address_part(
                c,
                lambda x: setattr(x, 'PostalCode', v)
            )
        ),

        _SimpleBulkMapping(
            header=_StringTable.CountryCode,
            field_to_csv=lambda c: BulkLocationAdExtension.get_address_part(c, lambda x: x.CountryCode),
            csv_to_field=lambda c, v: BulkLocationAdExtension.set_address_part(
                c,
                lambda x: setattr(x, 'CountryCode', v)
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.Latitude,
            field_to_csv=lambda c: BulkLocationAdExtension.get_geo_point_part(
                c,
                lambda x: bulk_str(
                    float(x.LatitudeInMicroDegrees) / 1000000.0
                )
                if x.LatitudeInMicroDegrees is not None else None
            ),
            csv_to_field=lambda c, v: BulkLocationAdExtension.set_geo_point_part(
                c,
                lambda x, latitude: setattr(x, 'LatitudeInMicroDegrees', int(round(float(latitude) * 1000000))),
                v
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.Longitude,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / audiences / bulk_remarketing_list.py View on Github external
_SimpleBulkMapping(
            _StringTable.MembershipDuration,
            field_to_csv=lambda c: bulk_str(c.remarketing_list.MembershipDuration),
            csv_to_field=lambda c, v: setattr(c.remarketing_list, 'MembershipDuration', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Scope,
            field_to_csv=lambda c: bulk_str(c.remarketing_list.Scope),
            csv_to_field=lambda c, v: setattr(c.remarketing_list, 'Scope', v if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.TagId,
            field_to_csv=lambda c: bulk_str(c.remarketing_list.TagId),
            csv_to_field=lambda c, v: setattr(c.remarketing_list, 'TagId', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.RemarketingRule,
            field_to_csv=lambda c: field_to_csv_RemarketingRule(c.remarketing_list),
            csv_to_field=lambda c, v: csv_to_field_RemarketingRule(c.remarketing_list, v)
        ),
        _SimpleBulkMapping(
            _StringTable.AudienceSearchSize,
            field_to_csv=lambda c: bulk_str(c.remarketing_list.SearchSize),
            csv_to_field=lambda c, v: setattr(c.remarketing_list, 'SearchSize', int(v) if v else None)
        ),       
        _SimpleBulkMapping(
            header=_StringTable.AudienceNetworkSize,
            field_to_csv=lambda c: bulk_str(c.remarketing_list.AudienceNetworkSize),
            csv_to_field=lambda c, v: setattr(c.remarketing_list, 'AudienceNetworkSize', v if v else None)
        ),
        _SimpleBulkMapping(
            _StringTable.SupportedCampaignTypes,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / ad_extensions / bulk_sitelink_ad_extensions.py View on Github external
see Sitelink Ad Extension at https://go.microsoft.com/fwlink/?linkid=846127.
        """

        return self._ad_extension

    @sitelink_ad_extension.setter
    def sitelink_ad_extension(self, value):
        self._ad_extension = value

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.SiteLinkDescription1,
            field_to_csv=lambda c: c.sitelink_ad_extension.Description1,
            csv_to_field=lambda c, v: setattr(c.sitelink_ad_extension, 'Description1', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.SiteLinkDescription2,
            field_to_csv=lambda c: c.sitelink_ad_extension.Description2,
            csv_to_field=lambda c, v: setattr(c.sitelink_ad_extension, 'Description2', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.DestinationUrl,
            field_to_csv=lambda c: bulk_optional_str(c.sitelink_ad_extension.DestinationUrl, c.sitelink_ad_extension.Id),
            csv_to_field=lambda c, v: setattr(c.sitelink_ad_extension, 'DestinationUrl', v if v else '')
        ),
        _SimpleBulkMapping(
            header=_StringTable.SiteLinkDisplayText,
            field_to_csv=lambda c: c.sitelink_ad_extension.DisplayText,
            csv_to_field=lambda c, v: setattr(c.sitelink_ad_extension, 'DisplayText', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.FinalUrl,
github BingAds / BingAds-Python-SDK / bingads / v12 / bulk / entities / labels / bulk_label_associations.py View on Github external
    @property
    def status(self):
        """ the status of bulk record
        Corresponds to the 'Status' field in the bulk file.

        :rtype: str
        """
        return self._status

    @status.setter
    def status(self, value):
        self._status = value

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.Status,
            field_to_csv=lambda c: bulk_str(c.status),
            csv_to_field=lambda c, v: setattr(
                c,
                'status',
                v if v else None
            )
        ),
        _SimpleBulkMapping(
            header=_StringTable.Id,
            field_to_csv=lambda c: c.label_association.LabelId,
            csv_to_field=lambda c, v: setattr(
                c.label_association,
                'LabelId',
                int(v) if v else None
            )