Ejemplo n.º 1
0
Archivo: tg.py Proyecto: kosyachniy/web
"""
Functionality for working with Telegram
"""

from tgio import Telegram

from api.lib import cfg

TG_TOKEN = cfg('tg.token')

tg = Telegram(TG_TOKEN)
Ejemplo n.º 2
0
"""
Payments functionality for the API
"""

from yookassa import Configuration, Payment

from api.lib import cfg

Configuration.account_id = cfg('yookassa.id')
Configuration.secret_key = cfg('yookassa.secret')


def create(amount, description, data=None, renewal=None):
    """ Create a payment """

    req = {
        'amount': {
            'value': f'{amount}.00',
            'currency': 'RUB'
        },
        'description': description,
        'metadata': data,
    }

    if renewal:
        req['payment_method_id'] = renewal
    else:
        req['confirmation'] = {
            'type': 'embedded',
        }
        req['capture'] = True
Ejemplo n.º 3
0
"""
Base model of DB object
"""

from consys import make_base, Attribute

from api.lib import cfg

HOST = cfg('mongo.host')
NAME = cfg('PROJECT_NAME')
LOGIN = cfg('mongo.login')
PASSWORD = cfg('mongo.password')

Base = make_base(HOST, NAME, LOGIN, PASSWORD)

__all__ = (
    'Base',
    'Attribute',
)
Ejemplo n.º 4
0
"""
Sending SMS messages
"""

from api.lib import cfg

LOGIN = cfg('smsc.login')
PASSWORD = cfg('smsc.password')

# TODO: Use pip/smsc
Ejemplo n.º 5
0
"""
Reports functionality for the API
"""

from tgreports import Report

from api.lib import cfg

MODE = cfg('mode')
TG_TOKEN = cfg('tg.token')
BUG_CHAT = cfg('bug_chat')

report = Report(MODE, TG_TOKEN, BUG_CHAT)