Exemple #1
0
    def put(self):
        req = json.loads(self.request.body)
        adv = db.Query(models.Advertiser).filter('id =', req['id']).get()
        if not adv:
            adv = models.Advertiser(name=req['name'].encode('utf-8'),
                                    id=req['id'],
                                    media_id=req['media_id'],
                                    score=req['score'],
                                    active=req['active'],
                                    ratio=req['ratio'],
                                    expire=req['expire'],
                                    average=req['average'],
                                    vc_pid=req['vc_pid'])
        else:
            adv.name = req['name'].encode('utf-8')
            adv.media_id = req['media_id'],
            adv.score = req['score']
            adv.active = req['active']
            adv.ratio = req['ratio']
            adv.expire = req['expire']
            adv.average = req['average']
            adv.vc_pid = req['vc_pid']

        adv.put()
        body = {}
        return self.json_response(body)
Exemple #2
0
    def post(self, user):
        name = self.request.get('name')
        ratio = int(self.request.get('ratio'))
        expire = int(self.request.get('expire'))
        average = int(self.request.get('average'))
        vc_pid = self.request.get('vc_pid', "")

        adv = models.Advertiser(
            #key_name = user['id'] + "." + name,
            name=name,
            user_id=user['id'],
            ratio=ratio,
            expire=expire,
            average=average,
            vc_pid=vc_pid,
        )
        adv.put()
        return self.redirect(self.url_for('admin_top'))
Exemple #3
0
def insert_advertisexs():

    email_template_breitbart = """
    Hey %s,

    I'm getting in touch with you as part of the Sleeping Giants campaign. Did you know that %s has ads appearing on Breitbart.com?
    Breitbart is widely known as a hate speech site, regularly distributing anti-Semitic, anti-Muslim, xenophobic and misogynist propaganda - and it's being propped up by ad revenues sent from companies like yours via 3rd party ad platforms.

    Is this something you support?

    If not, you can change this by contacting your ad agency and asking them to exclude Breitbart from your media buy.
    Will you please consider joining 700+ companies who have already blacklisted Breitbart? Please let me know. We would love to add you to the confirmed list!

    I hope to see the advertisements taken down,
    Sal
    """

    breitbart_key = models.Advertisee(name='Breitbart', description='Hateful website with neonazi leader.', email=email_template_breitbart).put()
    poc_kayak_key = models.POC(name='Stephanie', email='*****@*****.**').put()
    kayak_key = models.Advertiser(name='Kayak', pocs=[poc_kayak_key]).put()
    breitbart = breitbart_key.get()
    breitbart.advertisers.append(kayak_key)
    breitbart.put()
Exemple #4
0
def create_blank_advertiser():

    advertisee = models.Advertiser()

    return advertisee
Exemple #5
0
def insert_advertiser():

    poc_uber_key = models.POC(name='Alex', email='*****@*****.**').put()
    models.Advertiser(name='Uber', pocs=[poc_uber_key]).put()