Esempio n. 1
0
    def __init__(self):
        config = get_config()
        self.db = config.get_redis_db()
        self.hostname = config.get_redis_hostname()
        self.port = config.get_redis_port()

        self.connect()
Esempio n. 2
0
    def __init__(self):
        config = get_config()
        self.token = config.get_telegram_token()
        super(TeleBot, self).__init__(self.token)

        poll = threading.Thread(target=self.start_pool)
        poll.setDaemon(True)
        poll.start()
Esempio n. 3
0
    def __init__(self):
        config = get_config()
        self.hostname = config.get_mongodb_hostname()
        self.port = config.get_mongodb_port()
        self.database = config.get_mongodb_db()

        i = 0
        while i < self.connections_count:
            self._connections.append(self.connect())
            i += 1
Esempio n. 4
0
 def __init__(self):
     config = get_config()
     self.account_id = config.get_broker_account_id()
     self.environment = config.get_broker_environment()
     self.access_token = config.get_broker_access_token()
     self.api = oandapy.API(
         **{
             "environment": config.get_broker_environment(),
             "access_token": config.get_broker_access_token(),
         })
Esempio n. 5
0
    def __init__(self):
        config = get_config()
        self.username = config.get_postgres_username()
        self.password = config.get_postgres_password()
        self.hostname = config.get_postgres_hostname()
        self.port = config.get_postgres_port()
        self.database = config.get_postgres_database()

        i = 0
        while i < self.connections_count:
            self._connections.append(self.connect())
            i += 1
Esempio n. 6
0
def after_request(response):
    import logging

    logger = logging.getLogger('waitress2')
    strr = datetime.now().strftime("%d-%m %H:%M:%S") + " - " + str(
        response.status_code) + " - " + (
            request.headers.get('X-Real-IP')
            if request.headers.get('X-Real-IP') else request.remote_addr
        ) + " - " + request.method + " - " + request.path
    logger.warning(strr)

    if get_config().prod is False:
        response.headers.add('Access-Control-Allow-Origin', '*')
        response.headers.add('Access-Control-Allow-Headers',
                             'Content-Type,Authorization')
        response.headers.add('Access-Control-Allow-Methods',
                             'GET,PUT,POST,DELETE,OPTIONS')
    return response
Esempio n. 7
0
 def config():
     return config.get_config()
Esempio n. 8
0
 def __init__(self):
     config = get_config()
     self.account_id = config.get_broker_account_id()
     self.access_token = config.get_broker_access_token()
     self.environment = config.get_broker_environment()
     self.instruments = config.get_broker_instruments()