How to use the bingads.v10.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 / v10 / bulk / entities / bulk_ads.py View on Github external
raise ValueError('Not an instance of AppInstallAd')
        self._ad = app_install_ad

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.AppPlatform,
            field_to_csv=lambda c: c.app_install_ad.AppPlatform,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'AppPlatform', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.AppStoreId,
            field_to_csv=lambda c: c.app_install_ad.AppStoreId,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'AppStoreId', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Title,
            field_to_csv=lambda c: c.app_install_ad.Title,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'Title', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Text,
            field_to_csv=lambda c: c.app_install_ad.Text,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'Text', v)
        ),
    ]

    def process_mappings_from_row_values(self, row_values):
        self.app_install_ad = _CAMPAIGN_OBJECT_FACTORY_V10.create('AppInstallAd')
        self.app_install_ad.Type = 'AppInstall'
        super(BulkAppInstallAd, self).process_mappings_from_row_values(row_values)
        row_values.convert_to_entity(self, BulkAppInstallAd._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / ad_extensions / common.py View on Github external
header=_StringTable.Version,
            field_to_csv=lambda c: bulk_str(c._ad_extension.Version),
            csv_to_field=lambda c, v: setattr(c._ad_extension, 'Version', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.account_id),
            csv_to_field=lambda c, v: setattr(c, 'account_id', int(v))
        ),
        _SimpleBulkMapping(
            header=_StringTable.StartDate,
            field_to_csv=lambda c: field_to_csv_SchedulingStartDate(c._ad_extension.Scheduling),
            csv_to_field=lambda c, v: csv_to_field_Date(c._ad_extension.Scheduling, 'StartDate', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.EndDate,
            field_to_csv=lambda c: field_to_csv_SchedulingEndDate(c._ad_extension.Scheduling),
            csv_to_field = lambda c, v: csv_to_field_Date(c._ad_extension.Scheduling, 'EndDate', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.AdSchedule,
            field_to_csv=lambda c: field_to_csv_AdSchedule(c._ad_extension.Scheduling),
            csv_to_field=lambda c, v: csv_to_field_AdSchedule(c._ad_extension.Scheduling, v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.UseSearcherTimeZone,
            field_to_csv=lambda c: field_to_csv_UseSearcherTimeZone(c._ad_extension.Scheduling),
            csv_to_field=lambda c, v: setattr(c._ad_extension.Scheduling, 'UseSearcherTimeZone', parse_bool(v))
        ),
    ]

    def process_mappings_from_row_values(self, row_values):
github BingAds / BingAds-Python-SDK / bingads / internal / extensions.py View on Github external
def budget_to_csv(bulk_campaign, row_values):
    budget_type = bulk_campaign.campaign.BudgetType
    if not budget_type:
        return

    if _is_daily_budget(str(budget_type)):
        row_values[_StringTable.Budget] = bulk_str(bulk_campaign.campaign.DailyBudget)
    else:
        row_values[_StringTable.Budget] = bulk_str(bulk_campaign.campaign.MonthlyBudget)
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / bulk_ads.py View on Github external
""" The App Install Ad.

        see App Install Ad at http://go.microsoft.com/fwlink/?LinkID=730549.
        """

        return self._ad

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

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.AppPlatform,
            field_to_csv=lambda c: c.app_install_ad.AppPlatform,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'AppPlatform', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.AppStoreId,
            field_to_csv=lambda c: c.app_install_ad.AppStoreId,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'AppStoreId', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Title,
            field_to_csv=lambda c: c.app_install_ad.Title,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'Title', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Text,
            field_to_csv=lambda c: c.app_install_ad.Text,
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / bulk_ads.py View on Github external
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.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,
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'TitlePart2', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Path1,
            field_to_csv=lambda c: c.expanded_text_ad.Path1,
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'Path1', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Path2,
            field_to_csv=lambda c: c.expanded_text_ad.Path2,
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'Path2', v)
        ),
    ]

    def process_mappings_from_row_values(self, row_values):
        self.expanded_text_ad = _CAMPAIGN_OBJECT_FACTORY_V10.create('ExpandedTextAd')
        self.expanded_text_ad.Type = 'ExpandedText'
        super(BulkExpandedTextAd, self).process_mappings_from_row_values(row_values)
        row_values.convert_to_entity(self, BulkExpandedTextAd._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / ad_extensions / bulk_site_links_ad_extensions.py View on Github external
""" The version of the ad extension.

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

        :rtype: int
        """

        return self._identifier.version

    @version.setter
    def version(self, value):
        self._identifier._version = value

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.SiteLinkExtensionOrder,
            field_to_csv=lambda c: bulk_str(c.order),
            csv_to_field=lambda c, v: setattr(c, 'order', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.SiteLinkDisplayText,
            field_to_csv=lambda c: c.site_link.DisplayText,
            csv_to_field=lambda c, v: setattr(c.site_link, 'DisplayText', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.SiteLinkDestinationUrl,
            field_to_csv=lambda c: c.site_link.DestinationUrl,
            csv_to_field=lambda c, v: setattr(c.site_link, 'DestinationUrl', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.SiteLinkDescription1,
            field_to_csv=lambda c: c.site_link.Description1,
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / ad_extensions / common.py View on Github external
""" The ad extension's parent account identifier.

        Corresponds to the 'Parent Id' field in the bulk file.

        :rtype: int
        """

        return self._account_id

    @account_id.setter
    def account_id(self, account_id):
        self._account_id = account_id

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.Status,
            field_to_csv=lambda c: bulk_str(c._ad_extension.Status),
            csv_to_field=lambda c, v: setattr(c._ad_extension, 'Status', v if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Id,
            field_to_csv=lambda c: bulk_str(c._ad_extension.Id),
            csv_to_field=lambda c, v: setattr(c._ad_extension, 'Id', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Version,
            field_to_csv=lambda c: bulk_str(c._ad_extension.Version),
            csv_to_field=lambda c, v: setattr(c._ad_extension, 'Version', int(v) if v else None)
        ),
        _SimpleBulkMapping(
            header=_StringTable.ParentId,
            field_to_csv=lambda c: bulk_str(c.account_id),
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / bulk_ads.py View on Github external
header=_StringTable.Title,
            field_to_csv=lambda c: c.text_ad.Title,
            csv_to_field=lambda c, v: setattr(c.text_ad, 'Title', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Text,
            field_to_csv=lambda c: c.text_ad.Text,
            csv_to_field=lambda c, v: setattr(c.text_ad, 'Text', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.DisplayUrl,
            field_to_csv=lambda c: bulk_optional_str(c.text_ad.DisplayUrl),
            csv_to_field=lambda c, v: setattr(c.text_ad, 'DisplayUrl', v if v else '')
        ),
        _SimpleBulkMapping(
            header=_StringTable.DestinationUrl,
            field_to_csv=lambda c: bulk_optional_str(c.text_ad.DestinationUrl),
            csv_to_field=lambda c, v: setattr(c.text_ad, 'DestinationUrl', v if v else '')
        ),
        _SimpleBulkMapping(
            header=_StringTable.AdFormatPreference,
            field_to_csv=lambda c: field_to_csv_AdFormatPreference(c.text_ad),
            csv_to_field=lambda c, v: csv_to_field_AdFormatPreference(c.text_ad, v)
        ),
    ]

    def process_mappings_from_row_values(self, row_values):
        self.text_ad = _CAMPAIGN_OBJECT_FACTORY_V10.create('TextAd')
        self.text_ad.Type = 'Text'
        super(BulkTextAd, self).process_mappings_from_row_values(row_values)
        row_values.convert_to_entity(self, BulkTextAd._MAPPINGS)
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / bulk_ads.py View on Github external
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.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,
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'TitlePart2', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Path1,
            field_to_csv=lambda c: c.expanded_text_ad.Path1,
            csv_to_field=lambda c, v: setattr(c.expanded_text_ad, 'Path1', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Path2,
            field_to_csv=lambda c: c.expanded_text_ad.Path2,
github BingAds / BingAds-Python-SDK / bingads / v10 / bulk / entities / bulk_ads.py View on Github external
return self._ad

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

    _MAPPINGS = [
        _SimpleBulkMapping(
            header=_StringTable.AppPlatform,
            field_to_csv=lambda c: c.app_install_ad.AppPlatform,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'AppPlatform', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.AppStoreId,
            field_to_csv=lambda c: c.app_install_ad.AppStoreId,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'AppStoreId', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Title,
            field_to_csv=lambda c: c.app_install_ad.Title,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'Title', v)
        ),
        _SimpleBulkMapping(
            header=_StringTable.Text,
            field_to_csv=lambda c: c.app_install_ad.Text,
            csv_to_field=lambda c, v: setattr(c.app_install_ad, 'Text', v)
        ),
    ]

    def process_mappings_from_row_values(self, row_values):