“尝试使用意外的mimetype解码JSON:”

时间:2018-07-25 01:39:28

标签: python json

运行代码时,我不断收到此错误:“尝试使用意外的mimetype解码JSON:'

以下是尝试连接到Web套接字的代码:

async def websocket_handler(uri, headers, client=None, channel=None):
async with aiohttp.ClientSession() as session:
    async with session.ws_connect(uri, headers=headers, heartbeat=5, timeout=30) as ws:
        if channel and client:
            await client.send_message(channel, "@everyone Join the Channel!")
            print("Connected!")
            async for msg in ws:
                if msg.type == aiohttp.WSMsgType.TEXT:
                    message = msg.data
                    message = re.sub(r"[\x00-\x1f\x7f-\x9f]", "", message)

任何帮助将不胜感激!

0 个答案:

没有答案