Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def start(self):
d = PathInfoDispatcher({"/": self.app})
self.server = Server(("0.0.0.0", self.proxyport), d)
self.proxy_thread = threading.Thread(target=self.server.start)
self.proxy_thread.daemon = True
self.proxy_thread.start()
BitcoinD.start(self)
# Now that bitcoind is running on the real rpcport, let's tell all
# future callers to talk to the proxyport. We use the bind_addr as a
# signal that the port is bound and accepting connections.
while self.server.bind_addr[1] == 0:
pass
self.proxiedport = self.rpcport
self.rpcport = self.server.bind_addr[1]
logging.debug(
"bitcoind reverse proxy listening on {}, forwarding to {}".format(
self.rpcport, self.proxiedport
def start(self):
d = PathInfoDispatcher({'/': self.app})
self.server = Server(('0.0.0.0', self.rpcport), d)
self.proxy_thread = threading.Thread(target=self.server.start)
self.proxy_thread.daemon = True
self.proxy_thread.start()
# Now that bitcoind is running on the real rpcport, let's tell all
# future callers to talk to the proxyport. We use the bind_addr as a
# signal that the port is bound and accepting connections.
while self.server.bind_addr[1] == 0:
pass
self.rpcport = self.server.bind_addr[1]
logging.debug("BitcoinRpcProxy proxying incoming port {} to {}".format(self.rpcport, self.bitcoind.rpcport))
def run(self):
self._configure_flask_app()
dispatcher = PathInfoDispatcher({'/': app})
self.server = WSGIServer((self.host, self.port), dispatcher)
self.server.start()
return app(environ, start_response)
start_response(
'404 Not Found',
[('Content-Type', 'text/plain'), ('Content-Length', '0')],
)
return ['']
# compatibility aliases
globals().update(
WSGIServer=Server,
WSGIGateway=Gateway,
WSGIGateway_u0=Gateway_u0,
WSGIGateway_10=Gateway_10,
WSGIPathInfoDispatcher=PathInfoDispatcher,
)
def start(self):
d = PathInfoDispatcher({'/': self.app})
self.server = Server(('0.0.0.0', self.proxyport), d)
self.proxy_thread = threading.Thread(target=self.server.start)
self.proxy_thread.daemon = True
self.proxy_thread.start()
BitcoinD.start(self)
# Now that bitcoind is running on the real rpcport, let's tell all
# future callers to talk to the proxyport. We use the bind_addr as a
# signal that the port is bound and accepting connections.
while self.server.bind_addr[1] == 0:
pass
self.proxiedport = self.rpcport
self.rpcport = self.server.bind_addr[1]
logging.debug("bitcoind reverse proxy listening on {}, forwarding to {}".format(
self.rpcport, self.proxiedport
))
def start_web_rest_server(models, rest_port, num_threads):
d = PathInfoDispatcher({'/': create_rest_api(models)})
server = WSGIServer(('0.0.0.0', rest_port), d,
numthreads=num_threads,
request_queue_size=GLOBAL_CONFIG[
'rest_requests_queue_size'])
logger.info("REST server listens on port {port} and will be "
"serving models: {models}".format(port=rest_port,
models=list(models.keys())))
try:
server.start()
except KeyboardInterrupt:
server.stop()
def init_web():
d = PathInfoDispatcher({'/': web_app})
GM.web_server = WsgiServer((GM.cfg['Web_Interface']['WebIP'], int(GM.cfg['Web_Interface']['WebPort'])), d)
GM.web_server.start()
@app.route('/')
@app.route('/status/')
def redirect_to_wiki():
logging.debug("Visit https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/wiki/UNICORN-"
"Monitoring-API-Service for further information!")
return redirect("https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/wiki/"
"UNICORN-Monitoring-API-Service", code=302)
api = Api(app)
api.add_resource(BinanceWebSocketApiRestServer,
"/status//",
"/status//",
resource_class_kwargs={'handler_binance_websocket_api_manager': self,
'warn_on_update': warn_on_update})
try:
dispatcher = wsgi.PathInfoDispatcher({'/': app})
self.monitoring_api_server = wsgi.WSGIServer((host, port), dispatcher)
self.monitoring_api_server.start()
except RuntimeError as error_msg:
logging.error("monitoring API service is going down! - info: " + str(error_msg))