How to use the starthinker.task.traffic.dao.BaseDAO function in starthinker

To help you get started, we’ve selected a few starthinker 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 google / starthinker / task / traffic / campaign.py View on Github external
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of Ads.

"""

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.landing_page import LandingPageDAO
from starthinker.task.traffic.feed import FieldMap
from starthinker.task.traffic.store import store
from starthinker.task.traffic.class_extensions import StringExtensions


class CampaignDAO(BaseDAO):
  """Campaign data access object.

  Inherits from BaseDAO and implements campaign specific logic for creating and
  updating campaigns.
  """

  def __init__(self, auth, profile_id):
    """Initializes CampaignDAO with profile id and authentication scheme."""
    super(CampaignDAO, self).__init__(auth, profile_id)

    self.landing_page_dao = LandingPageDAO(auth, profile_id)
    self._id_field = FieldMap.CAMPAIGN_ID
    self._search_field = FieldMap.CAMPAIGN_NAME
    self._list_name = 'campaigns'

    self._parent_filter_name = None
github google / starthinker / starthinker / task / traffic / landing_page.py View on Github external
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of landing pages.

"""

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.feed import FieldMap


class LandingPageDAO(BaseDAO):
  """Landing page data access object.

  Inherits from BaseDAO and implements landing page specific logic for creating
  and
  updating landing pages.
  """

  def __init__(self, auth, profile_id, is_admin):
    """Initializes LandingPageDAO with profile id and authentication scheme."""

    super(LandingPageDAO, self).__init__(auth, profile_id, is_admin)

    self._id_field = FieldMap.CAMPAIGN_LANDING_PAGE_ID
    self._search_field = FieldMap.CAMPAIGN_LANDING_PAGE_NAME
    self._list_name = 'landingPages'
    self._entity = 'LANDING_PAGE'
github google / starthinker / task / traffic / placement_group.py View on Github external
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of placement groups.

"""

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.campaign import CampaignDAO
from starthinker.task.traffic.feed import FieldMap


class PlacementGroupDAO(BaseDAO):
  """Placement group data access object.

  Inherits from BaseDAO and implements placement group specific logic for creating
  and
  updating placement group.
  """

  def __init__(self, auth, profile_id):
    """Initializes PlacementGroupDAO with profile id and authentication scheme."""

    super(PlacementGroupDAO, self).__init__(auth, profile_id)

    self.campaign_dao = CampaignDAO(auth, profile_id)
    self._service = self.service.placementGroups()
    self._id_field = FieldMap.PLACEMENT_GROUP_ID
    self._search_field = FieldMap.PLACEMENT_GROUP_NAME
github google / starthinker / starthinker / task / traffic / ad.py View on Github external
"""Handles creation and updates of Ads."""

import time, json

from starthinker.task.traffic.campaign import CampaignDAO
from starthinker.task.traffic.class_extensions import StringExtensions
from starthinker.task.traffic.creative import CreativeDAO
from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.event_tag import EventTagDAO
from starthinker.task.traffic.feed import FieldMap
from starthinker.task.traffic.landing_page import LandingPageDAO
from starthinker.task.traffic.placement import PlacementDAO
from starthinker.task.traffic.store import store


class AdDAO(BaseDAO):
  """Ad data access object.

  Inherits from BaseDAO and implements ad specific logic for creating and
  updating ads.
  """

  def __init__(self, auth, profile_id, is_admin):
    """Initializes AdDAO with profile id and authentication scheme."""
    super(AdDAO, self).__init__(auth, profile_id, is_admin)

    self._id_field = FieldMap.AD_ID
    self._search_field = FieldMap.AD_NAME
    self._list_name = 'ads'

    self._creative_dao = CreativeDAO(auth, profile_id, is_admin)
    self._placement_dao = PlacementDAO(auth, profile_id, is_admin)
github google / starthinker / starthinker / task / traffic / dynamic_targeting_key.py View on Github external
#      https://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of dynamic targeting keys."""

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.feed import FieldMap


class DynamicTargetingKeyDAO(BaseDAO):
  """Landing page data access object.

  Inherits from BaseDAO and implements dynamic targeting key specific logic for
  creating
  and
  updating dynamic targeting key.
  """

  def __init__(self, auth, profile_id, is_admin):
    """Initializes DynamicTargetingKeyDAO with profile id and authentication scheme."""

    super(DynamicTargetingKeyDAO, self).__init__(auth, profile_id, is_admin)

    self._id_field = None
    self._search_field = None
    self._list_name = 'dynamicTargetingKeys'
github google / starthinker / task / traffic / creative_association.py View on Github external
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of creative asset association.

"""

import json

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.feed import FieldMap
from starthinker.task.traffic.campaign import CampaignDAO
from starthinker.task.traffic.creative import CreativeDAO


class CreativeAssociationDAO(BaseDAO):
  """Creative Association data access object.

  Inherits from BaseDAO and implements creative association specific logic for
  creating and
  updating creative association.
  """

  def __init__(self, auth, profile_id):
    """Initializes CreativeAssociationDAO with profile id and authentication scheme."""
    super(CreativeAssociationDAO, self).__init__(auth, profile_id)

    self._service = self.service.campaignCreativeAssociations()
    self._id_field = FieldMap.CAMPAIGN_CREATIVE_ASSOCIATION_ID

    self.campaign_dao = CampaignDAO(auth, profile_id)
    self.creative_dao = CreativeDAO(auth, profile_id)
github google / starthinker / starthinker / task / traffic / event_tag.py View on Github external
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of Ads.

"""

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.campaign import CampaignDAO
from starthinker.task.traffic.feed import FieldMap


class EventTagDAO(BaseDAO):
  """Event Tag data access object.

  Inherits from BaseDAO and implements Event Tag specific logic for creating and
  updating Event Tags.
  """

  def __init__(self, auth, profile_id, is_admin):
    """Initializes EventTagDAO with profile id and authentication scheme."""
    super(EventTagDAO, self).__init__(auth, profile_id, is_admin)

    self._id_field = FieldMap.EVENT_TAG_ID

    # This causes the dao to search event tag by name, but
    # to do so it is required to pass campaign or advertiser id
    # self._search_field = FieldMap.EVENT_TAG_NAME
    #self._search_field = FieldMap.EVENT_TAG_NAME
github google / starthinker / starthinker / task / traffic / creative_association.py View on Github external
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of creative asset association.

"""

import json

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.feed import FieldMap
from starthinker.task.traffic.campaign import CampaignDAO
from starthinker.task.traffic.creative import CreativeDAO


class CreativeAssociationDAO(BaseDAO):
  """Creative Association data access object.

  Inherits from BaseDAO and implements creative association specific logic for
  creating and
  updating creative association.
  """

  def __init__(self, auth, profile_id, is_admin):
    """Initializes CreativeAssociationDAO with profile id and authentication scheme."""
    super(CreativeAssociationDAO, self).__init__(auth, profile_id, is_admin)

    self._id_field = FieldMap.CAMPAIGN_CREATIVE_ASSOCIATION_ID

    self.campaign_dao = CampaignDAO(auth, profile_id, is_admin)
    self.creative_dao = CreativeDAO(auth, profile_id, is_admin)
github google / starthinker / starthinker / task / traffic / placement.py View on Github external
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of Placements.

"""

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.campaign import CampaignDAO
from starthinker.task.traffic.video_format import VideoFormatDAO
from starthinker.task.traffic.feed import FieldMap
from starthinker.task.traffic.placement_group import PlacementGroupDAO
from starthinker.task.traffic.class_extensions import StringExtensions


class PlacementDAO(BaseDAO):
  """Placement data access object.

  Inherits from BaseDAO and implements placement specific logic for creating and
  updating placement.
  """

  cache = {}

  def __init__(self, auth, profile_id, is_admin):
    """Initializes PlacementDAO with profile id and authentication scheme."""
    super(PlacementDAO, self).__init__(auth, profile_id, is_admin)

    self._entity = 'PLACEMENT'

    self.campaign_dao = CampaignDAO(auth, profile_id, is_admin)
    self.video_format_dao = VideoFormatDAO(auth, profile_id, is_admin)
github google / starthinker / starthinker / task / traffic / creative.py View on Github external
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
###########################################################################
"""Handles creation and updates of Creatives.

"""

from starthinker.task.traffic.dao import BaseDAO
from starthinker.task.traffic.feed import FieldMap
from starthinker.task.traffic.creative_assets import CreativeAssetDAO
from starthinker.task.traffic.landing_page import LandingPageDAO


class CreativeDAO(BaseDAO):
  """Creative data access object.

  Inherits from BaseDAO and implements creative specific logic for creating and
  updating creatives.
  """

  def __init__(self, auth, profile_id, is_admin):
    """Initializes CreativeDAO with profile id and authentication scheme."""
    super(CreativeDAO, self).__init__(auth, profile_id, is_admin)

    self._entity = 'CREATIVE'

    self._parent_filter_name = 'advertiserId'
    self._parent_filter_field_name = FieldMap.ADVERTISER_ID

    self._id_field = FieldMap.CREATIVE_ID