コード例 #1
0
def verifica_user():
    user_json = session['barzinga_user']
    user = User.query().filter(User.email == user_json["email"]).get()

    dx = user_json['email'].endswith('@dextra-sw.com')
    mutant = user_json['email'].endswith('@mutantbr.com')
    if not dx and not mutant:
        raise Exception('Invalid domain %s' % user_json['email'])

    if not user:
        # user = User(name = user_json['name'], email=user_json['email'], photo_url=user_json['picture'], money=0.0, admin=False, rfid=str(''))
        user = User(name = '', email=user_json['email'], photo_url=user_json['picture'], money=0.0, admin=False, infra=False, rfid=str(''), active = True)

        user.put()

        user_document = search.Document(
            fields=[
                search.TextField(name='name', value=user.name),
                search.TextField(name='email', value=user.email)
            ])

        search.Index(name='user').put(user_document)
    elif not user.photo_url:
        user.photo_url = user_json['picture']
        user.put()

    identity = Identity(user.key.id())
    identity_changed.send(current_app._get_current_object(), identity=identity)
コード例 #2
0
ファイル: controller.py プロジェクト: mugbug/BarzingaNow
def get_all(category=None):
    print category
    if category:
        if category == 'POSSOCOMPRAR':
            user_logged = session['barzinga_user']
            user = User.query().filter(
                User.email == user_logged["email"]).get()
            products = [
                p.to_dict()
                for p in Product.query(Product.price <= user.money).order(
                    Product.description).fetch()
            ]
        else:
            products = [
                p.to_dict()
                for p in Product.query(Product.category == category).order(
                    Product.description).fetch()
            ]
    else:
        products = [
            p.to_dict()
            for p in Product.query().order(Product.description).fetch()
        ]

    return json.dumps(products)
コード例 #3
0
def add_app():

    json_data = request.get_json()

    user_json = json_data.get('user')

    user = User.query().filter(User.email == user_json.get('email')).get()

    products = json_data.get('products')

    products_list = []
    quantity_table = {}

    for product in products:
        id = int(product['id'])
        quantity_table[id] = product['quantity']
        products_list.append(ndb.Key(Product, id).get())

    try:
        transaction = Transaction.new(user, products_list, quantity_table)
        transaction.put()
    except Exception as e:
        return str(e), 400

    return str('ok'), 200
コード例 #4
0
def transactions_user():
    logged_user = session['barzinga_user']
    logged_user = User.query().filter(User.email == logged_user["email"]).get()

    transactions = Transaction.query().filter(
        Transaction.user == logged_user.key).order(-Transaction.date).fetch(20)

    trans = []

    for t in transactions:
        transact = {}
        transact['id'] = str(t.key)
        transact['user'] = logged_user.name.encode('utf-8').strip()
        transact['value'] = str(t.value)
        transact['date'] = str(t.date.strftime('%d/%m/%y - %H:%M'))
        itens = []
        for it in t.items:
            item = {}
            transaction_item = it.get()

            prod = transaction_item.product.get()
            item['product'] = 'Nao Existe Mais'

            if prod:
                item['product'] = prod.description

            item['quantity'] = str(transaction_item.quantity)
            itens.append(item)

        transact['itens'] = itens
        trans.append(transact)

    return json.dumps(trans)
コード例 #5
0
def transactions_last_month():
    today = datetime.date.today()
    first = today.replace(day=1)
    lastMonthEnd = first - datetime.timedelta(days=1)
    lastMonthBegin = lastMonthEnd.replace(day=1)
    transactions = transactions_all(end=lastMonthEnd.strftime("%d-%m-%Y"), start=lastMonthBegin.strftime("%d-%m-%Y"))
    users = User.query().fetch()
    credits = credits_all(end=lastMonthEnd.strftime("%d-%m-%Y"), start=lastMonthBegin.strftime("%d-%m-%Y"))

    totalTransacoesCompra = 0.00
    totalInadimplentes = 0.00
    totalCreditosEmUsuarios = 0.00
    totalCreditosComprados = 0.00

    for t in transactions:
        totalTransacoesCompra += t.value

    for u in users:
        totalCreditosEmUsuarios += u.money

        if u.money < -0.01 :
            totalInadimplentes += u.money

    for c in credits:
        totalCreditosComprados += c.value

    resultado = 'Valor total das transacoes; '+str("%.2f" % round(totalTransacoesCompra,2))+'\n'
    resultado += 'Valor total dos creditos em usuarios; '+str("%.2f" % round(totalCreditosEmUsuarios,2))+'\n'
    resultado += 'Valor total dos Usuarios Negativos; '+str("%.2f" % round(totalInadimplentes,2))+'\n'
    resultado += 'Valor total dos Creditos Adquiridos; '+str("%.2f" % round(totalCreditosComprados,2))+'\n'

    make_blob_public(str(resultado), 'monthly', 'balance_'+lastMonthBegin.strftime("%d-%m-%Y"))

    return str('ok'), 200
コード例 #6
0
def dailyDebitExceeded():
    users = User.query().filter(User.money < -40.01,
                                User.active == True).fetch()
    users_email_list = []

    usersJson = 'email;valor \n'

    for u in users:
        usersJson += str(u.email) + ';' + str(
            "%.2f" % round(u.money, 2)) + ' \n'
        users_email_list.append(str(u.email))

    make_blob_public(usersJson, 'debitExceeded/',
                     datetime.datetime.now().strftime("%d_%m_%y"))

    if (len(users_email_list) != 0):
        mail.EmailMessage(
            sender='*****@*****.**',
            bcc=users_email_list,
            subject='Barzinga: Saldo em débito excedido',
            html=
            """\ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/><meta content="width=device-width" name="viewport"/><meta content="IE=edge" http-equiv="X-UA-Compatible"/><title></title><style type="text/css">body{margin: 0;padding: 0;}table,td,tr{vertical-align: top;border-collapse: collapse;}*{line-height: inherit;}a[x-apple-data-detectors=true]{color: inherit !important;text-decoration: none !important;}</style><style id="media-query" type="text/css">@media (max-width: 920px){.block-grid,.col{min-width: 320px !important;max-width: 100% !important;display: block !important;}.block-grid{width: 100% !important;}.col{width: 100% !important;}.col>div{margin: 0 auto;}img.fullwidth,img.fullwidthOnMobile{max-width: 100% !important;}.no-stack .col{min-width: 0 !important;display: table-cell !important;}.no-stack.two-up .col{width: 50% !important;}.no-stack .col.num4{width: 33% !important;}.no-stack .col.num8{width: 66% !important;}.no-stack .col.num4{width: 33% !important;}.no-stack .col.num3{width: 25% !important;}.no-stack .col.num6{width: 50% !important;}.no-stack .col.num9{width: 75% !important;}.video-block{max-width: none !important;}.mobile_hide{min-height: 0px;max-height: 0px;max-width: 0px;display: none;overflow: hidden;font-size: 0px;}.desktop_hide{display: block !important;max-height: none !important;}}</style></head><body class="clean-body" style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: transparent;"><table bgcolor="transparent" cellpadding="0" cellspacing="0" class="nl-container" role="presentation" style="table-layout: fixed; vertical-align: top; min-width: 320px; Margin: 0 auto; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: transparent; width: 100%;" valign="top" width="100%"><tbody><tr style="vertical-align: top;" valign="top"><td style="word-break: break-word; vertical-align: top;" valign="top"><div style="background-color:transparent;"><div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 900px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;"><div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;"><div class="col num12" style="min-width: 320px; max-width: 900px; display: table-cell; vertical-align: top; width: 900px;"><div style="background-color:#F4F4F4;width:100% !important;"><div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:15px; padding-bottom:15px; padding-right: 15px; padding-left: 15px;"><div align="center" class="img-container center fixedwidth" style="padding-right: 0px;padding-left: 0px;"><img align="center" alt="Image" border="0" class="center fixedwidth" src="https://i.imgur.com/bHxH9mX.png" style="text-decoration: none; -ms-interpolation-mode: bicubic; border: 0; height: auto; width: 100%; max-width: 172px; display: block;" title="Image" width="172"/></div></div></div></div></div></div></div><div style="background-color:transparent;"><div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 900px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: #FFFFFF;"><div style="border-collapse: collapse;display: table;width: 100%;background-color:#FFFFFF;"><div class="col num12" style="min-width: 320px; max-width: 900px; display: table-cell; vertical-align: top; width: 900px;"><div style="width:100% !important;"><div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:25px; padding-bottom:35px; padding-right: 0px; padding-left: 0px;"><div style="color:#555555;font-family:Arial, 'Helvetica Neue', Helvetica, sans-serif;line-height:1.5;padding-top:5px;padding-right:20px;padding-bottom:10px;padding-left:20px;"><div style="font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 12px; line-height: 1.5; color: #555555; mso-line-height-alt: 18px;"><p style="font-size: 14px; line-height: 1.5; text-align: center; mso-line-height-alt: 21px; margin: 0;">Olá, Dextran@!</p><p style="font-size: 14px; line-height: 1.5; text-align: center; mso-line-height-alt: 21px; margin: 0;"> </p><p style="font-size: 14px; line-height: 1.5; text-align: center; mso-line-height-alt: 21px; margin: 0;">Nossos sistemas perceberam que sua conta no Barzinga! encontra-se muito negativa.</p><p style="font-size: 14px; line-height: 1.5; text-align: center; mso-line-height-alt: 21px; margin: 0;">(╥ ﹏ ╥)</p></div></div><div align="center" class="img-container center fixedwidth" style="padding-right: 5px;padding-left: 5px;"><div style="font-size:1px;line-height:20px"> </div><img align="center" alt="Image" border="0" class="center fixedwidth" src="https://media.giphy.com/media/S6MfYgFHs00HFijzlG/giphy.gif" style="text-decoration: none; -ms-interpolation-mode: bicubic; border: 0; height: auto; width: 100%; max-width: 360px; display: block;" title="Image" width="360"/></div><div style="color:#555555;font-family:Arial, 'Helvetica Neue', Helvetica, sans-serif;line-height:1.5;padding-top:30px;padding-right:20px;padding-bottom:10px;padding-left:20px;"><div style="font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 12px; line-height: 1.5; color: #555555; mso-line-height-alt: 18px;"><p style="font-size: 14px; line-height: 1.5; text-align: center; mso-line-height-alt: 21px; margin: 0;">Por isso, gostaríamos de pedir que nos procure para se regularizar, urgentemente!<br/>(‘• ω • `) ♡</p></div></div></div></div></div></div></div></div><div style="background-color:transparent;"><div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 900px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;"><div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;"><div class="col num12" style="min-width: 320px; max-width: 900px; display: table-cell; vertical-align: top; width: 900px;"><div style="background-color:#f3f7fa;width:100% !important;"><div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:15px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;"><div align="center" class="img-container center fixedwidth" style="padding-right: 5px;padding-left: 5px;"><div style="font-size:1px;line-height:5px"> </div><img align="center" alt="Image" border="0" class="center fixedwidth" src="https://i.imgur.com/qGd2R2z.png" style="text-decoration: none; -ms-interpolation-mode: bicubic; border: 0; height: auto; width: 100%; max-width: 178px; display: block;" title="Image" width="178"/><div style="font-size:1px;line-height:5px"> </div></div><table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%"><tbody><tr style="vertical-align: top;" valign="top"><td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;" valign="top"><table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_content" height="0" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 1px solid #BBBBBB; height: 0px; width: 80%;" valign="top" width="80%"><tbody><tr style="vertical-align: top;" valign="top"><td height="0" style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td></tr></tbody></table></td></tr></tbody></table><div style="color:#555555;font-family:Arial, 'Helvetica Neue', Helvetica, sans-serif;line-height:1.2;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;"><div style="font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 12px; line-height: 1.2; color: #555555; mso-line-height-alt: 14px;"><p style="font-size: 10px; line-height: 1.2; text-align: center; mso-line-height-alt: 12px; margin: 0;"><span style="font-size: 10px; color: #999999;">Este e-mail é confidencial. Para mais informações, clique <a href="https://dextra.com.br/confidencial/" rel="noopener" style="text-decoration: underline; color: #0068A5;" target="_blank">aqui</a>.</span></p><p style="font-size: 10px; line-height: 1.2; text-align: center; mso-line-height-alt: 12px; margin: 0;"><span style="font-size: 10px; color: #999999;">Polis II de Alta Tecnologia - R. Dr. Ricardo Benetton Martins, 1000 - Prédio 11 - Bosque das Palmeiras, Campinas - SP, 13086-902</span></p></div></div><table cellpadding="0" cellspacing="0" class="social_icons" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt;" valign="top" width="100%"><tbody><tr style="vertical-align: top;" valign="top"><td style="word-break: break-word; vertical-align: top; padding-top: 5px; padding-right: 5px; padding-bottom: 10px; padding-left: 5px;" valign="top"><table activate="activate" align="center" alignment="alignment" cellpadding="0" cellspacing="0" class="social_table" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: undefined; mso-table-tspace: 0; mso-table-rspace: 0; mso-table-bspace: 0; mso-table-lspace: 0;" to="to" valign="top"><tbody><tr align="center" style="vertical-align: top; display: inline-block; text-align: center;" valign="top"><td style="word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 5px; padding-left: 5px;" valign="top"><a href="https://www.facebook.com/dextrasis" target="_blank"><img alt="Facebook" height="32" src="https://i.imgur.com/Ftl2iCe.png" style="text-decoration: none; -ms-interpolation-mode: bicubic; height: auto; border: none; display: block;" title="Facebook" width="32"/></a></td><td style="word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 5px; padding-left: 5px;" valign="top"><a href="https://www.instagram.com/dextra_digital/" target="_blank"><img alt="Instagram" height="32" src="https://i.imgur.com/8P9Zmjj.png" style="text-decoration: none; -ms-interpolation-mode: bicubic; height: auto; border: none; display: block;" title="Instagram" width="32"/></a></td><td style="word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 5px; padding-left: 5px;" valign="top"><a href="https://twitter.com/dextra_digital" target="_blank"><img alt="Twitter" height="32" src="https://i.imgur.com/x7vajxc.png" style="text-decoration: none; -ms-interpolation-mode: bicubic; height: auto; border: none; display: block;" title="Twitter" width="32"/></a></td><td style="word-break: break-word; vertical-align: top; padding-bottom: 5px; padding-right: 5px; padding-left: 5px;" valign="top"><a href="https://www.linkedin.com/company/dextra-digital" target="_blank"><img alt="LinkedIn" height="32" src="https://i.imgur.com/cvz1c8M.png" style="text-decoration: none; -ms-interpolation-mode: bicubic; height: auto; border: none; display: block;" title="LinkedIn" width="32"/></a></td></tr></tbody></table></td></tr></tbody></table></div></div></div></div></div></div></td></tr></tbody></table></body></html> """
        ).Send()
    users_email_list.clear()

    return json.dumps(usersJson)
コード例 #7
0
ファイル: main.py プロジェクト: infra-dextra/BarzingaNow
def on_identity_loaded(sender, identity):
    user_json = session['barzinga_user']
    user = User.query().filter(User.email == user_json["email"]).get()

    if user:
        identity.user = user.key.id()

        if user.admin:
            identity.provides.add(RoleNeed('admin'))
コード例 #8
0
def deactivate():
    user = User.query().filter(User.email == request.form['email']).get()

    if user:
        user.active = False
        user.put()
        return '', 204

    return '', 404
コード例 #9
0
def add():
    user_logged = session['barzinga_user']
    user_operator = User.query().filter(
        User.email == user_logged['email']).get()

    user_email = request.form['user']
    value = float(request.form['value'])
    user_email = user_email.split('@')[0] + '@dextra-sw.com'
    userClient = User.query().filter(User.email == user_email).get()
    if userClient:
        userClient.credit(value=value)
        userClient.put()
        credit = Credit(user_email=user_email,
                        value=value,
                        operator=user_operator.email)
        credit.put()
        return 'Barzingas creditados', 204
    else:
        return 'Usuario invalido', 406
コード例 #10
0
def put_rfid():
    user = User.query().filter(User.email == request.form['email']).get()
    rfid = request.form['rfid']
    name = request.form['name']
    if user:
        user.rfid = rfid
        user.name = name
        user.put()
        return '', 204

    return '', 404
コード例 #11
0
def put_pin():

    user_json = session['barzinga_user']
    user = User.query().filter(User.email == user_json["email"]).get()
    pin = request.form['pin']
    if user:
        user.pin = pin

    user.put()

    return '', 204
コード例 #12
0
def allCredits():
    users = User.query().fetch()

    usersJson = 'email,valor \n'

    for u in users:
        usersJson += str(u.email) + ',' + str(
            "%.2f" % round(u.money, 2)) + ' \n'

    make_blob_public(usersJson)
    return json.dumps(usersJson)
コード例 #13
0
def get_by_rfid(rfid):
    user = User.query().filter(User.rfid == rfid).get()
    if user:
        user_json = {
            'name': user.name,
            'email': user.email,
            'money': user.money,
            'photo_url': user.photo_url,
            'id': user.key.id()
        }
        return json.dumps(user_json)

    return '', 404
コード例 #14
0
def user_position(period):
    users = User.query().filter(User.money < 0.0).filter(User.active == True).fetch()
    users_email_list = []
    usersCsv = 'email;valor;active \n'

    for idx, user in enumerate(users):
        usersCsv += str(user.email)+';'+str("%.2f" % round(user.money,2))+';'+str(user.active)+' \n'
        mail = {}
        mail['Email'] = user.email
        users_email_list.append(mail)

    make_blob_public(usersCsv, period, 'user_positions_'+datetime.datetime.now().strftime("%d_%m_%y"))

    if (period == 'monthly' and len(users_email_list) != 0):
        print(users_email_list)
        response = send_simple_message(users_email_list)
        print(response)

    return json.dumps(usersCsv)
コード例 #15
0
def add():
    user_logged = session['barzinga_user']
    user_operator = User.query().filter(
        User.email == user_logged["email"]).get()
    if user_operator.admin:
        bucket_name = os.environ.get(
            'BUCKET_NAME', app_identity.get_default_gcs_bucket_name())
        description = request.form['description']
        category = request.form['category']
        price = float(request.form['price'])
        quantity = int(request.form['quantity'])

        image = request.files['image']
        image_url = None

        if image:
            write_retry_params = gcs.RetryParams(backoff_factor=1.1)
            filename = '/' + bucket_name + '/' + image.filename
            gcs_file = gcs.open(filename,
                                'w',
                                content_type=image.content_type,
                                retry_params=write_retry_params)
            gcs_file.write(image.read())
            gcs_file.close()

            blobstore_filename = '/gs' + filename
            key = blobstore.create_gs_key(blobstore_filename)

            image_url = get_serving_url(key)

        product = Product(description=description,
                          price=price,
                          quantity=quantity,
                          category=category,
                          image_url=image_url,
                          bar_code=str(''),
                          active=True)
        product.put()

        return '', 204
    else:
        return 'Precisa ser admin para cadastrar produtos', 401
コード例 #16
0
def dailyDebitExceeded():
    users = User.query().filter(User.money < -40.01 and User.active == True).fetch()
    users_email_list = []

    usersJson = 'email;valor \n'

    for u in users:
        usersJson += str(u.email)+';'+str("%.2f" % round(u.money,2))+' \n'
        users_email_list.append(str(u.email))

    make_blob_public(usersJson, 'debitExceeded/', datetime.datetime.now().strftime("%d_%m_%y"))

    if (len(users_email_list) != 0):
        print(users_email_list)
        #  mail.send_mail(sender = '*****@*****.**',
        #                bcc = users_email_list,
        #                 subject = 'Barzinga: Saldo em débito excedido',
        #                body = 'Ola, Dextrana(o)! Nossos sistemas perceberam que sua conta no Barzinga encontra-se muito negativa... Por isso, gostariamos de pedir que nos procure para se regularizar urgentemente!').Send()
    #  users_email_list.clear() - ISSO NÂO FUNCIONA

    return json.dumps(usersJson)
コード例 #17
0
def verifica_user():
    user_json = session['barzinga_user']
    user = User.query().filter(User.email == user_json["email"]).get()

    if not user:
        # user = User(name = user_json['name'], email=user_json['email'], photo_url=user_json['picture'], money=0.0, admin=False, rfid=str(''))
        user = User(name = '', email=user_json['email'], photo_url=user_json['picture'], money=0.0, admin=False, rfid=str(''))

        user.put()

        user_document = search.Document(
            fields=[
                search.TextField(name='name', value=user.name),
                search.TextField(name='email', value=user.email)
            ])

        search.Index(name='user').put(user_document)
    elif not user.photo_url:
        user.photo_url = user_json['picture']
        user.put()

    identity = Identity(user.key.id())
    identity_changed.send(current_app._get_current_object(), identity=identity)
コード例 #18
0
def add():
    # return 'Compra nao permitida', 403
    logged_user = session['barzinga_user']
    logged_user = User.query().filter(User.email == logged_user["email"]).get()

    products = json.loads(request.form['products'])

    products_list = []
    quantity_table = {}

    for product in products:
        quantity_table[product['id']] = product['quantity']
        products_list.append(ndb.Key(Product, product['id']).get())

    print products_list

    try:
        transaction = Transaction.new(logged_user, products_list,
                                      quantity_table)
        transaction.put()
    except Exception as e:
        return str(e), 400

    return '', 204
コード例 #19
0
def get_all():
    users = [u.to_dict() for u in User.query().fetch()]
    return json.dumps(users)
コード例 #20
0
def get_by_email(email):
    email = email.split('@')[0] + '@dextra-sw.com'
    userClient = User.query().filter(User.email == email).get()

    return json.dumps(userClient.to_dict())
コード例 #21
0
def get_logged():
    user_json = session['barzinga_user']
    user = User.query().filter(User.email == user_json["email"]).get()
    return json.dumps(user.to_dict())