From dee5092f74e796f01ab87474133df0af2b363e6c Mon Sep 17 00:00:00 2001 From: boke0 Date: Mon, 8 Mar 2021 23:18:52 +0900 Subject: [PATCH] [fix] --- mitama/app/http/request.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mitama/app/http/request.py b/mitama/app/http/request.py index 7316043..7dae952 100644 --- a/mitama/app/http/request.py +++ b/mitama/app/http/request.py @@ -3,8 +3,8 @@ import http.cookies import io import json +import importlib import wsgiref.util as wsgiutil -import uwsgi from urllib.parse import parse_qs @@ -27,11 +27,18 @@ def get(self, key): class uWSGIWebSocket: def __init__(self, env): - uwsgi.websocket_handshake(env['HTTP_SEC_WEBSOCKET_KEY'], env.get('HTTP_ORIGIN', '')) + self.uwsgi = importlib.import_module("uwsgi") + self.uwsgi.websocket_handshake( + env['HTTP_SEC_WEBSOCKET_KEY'], + env.get('HTTP_ORIGIN', '') + ) + def receive(self): - return uwsgi.websocket_recv() + return self.uwsgi.websocket_recv() + def send(self, message): - uwsgi.websocket_send(message) + self.uwsgi.websocket_send(message) + class _RequestPayload: def __init__(self, field_storage):