Пример #1
0
 def __init__(self, config, *args):
     if config['httpd']['listen']['ipv6']:
         self.address_family = SocketServer.socket.AF_INET6
     else:
         self.address_family = SocketServer.socket.AF_INET
     self.config = config
     BaseHTTPServer.HTTPServer.__init__(self, *args)
     if config['httpd']['listen']['ssl']:
         kwargs = {
             'server_side': True,
             'keyfile': config['httpd']['listen']['ssl_key'],
             'certfile': config['httpd']['listen']['ssl_cert']
         }
         if config['httpd']['listen']['ssl_version']:
             kwargs['ssl_version'] = getattr(ssl, 'PROTOCOL_%s' % config['httpd']['listen']['ssl_version'])
         if config['httpd']['listen']['ssl_ciphers']:
             kwargs['ciphers'] = config['httpd']['listen']['ssl_ciphers']
         self.socket = ssl.wrap_socket(self.socket, **kwargs)
     self.sql_engine = sql.create_engine(config['database']['url'])
Пример #2
0
 def __init__(self, config):
     self.config = config
     engine = sql.create_engine(self.config["database"]["url"], echo=self.config["debug"])
     self.conn = engine.connect()