Мне нужен файл сообщения из websocket.
из websocket import create_connection import json import pprint
# Initialize the headers needed for the websocket connection
headers = json.dumps({
'Date': 'Thu, 19 Mar 2020 10:27:04 GMT',
'Connection': 'upgrade',
'Host': '/dsalhlfj',
'Origin': '//dsfkjsafj',
'Upgrade': 'websocket',
'Sec-WebSocket-Extensions': 'permessage-deflate; client_max_window_bits',
'Sec-WebSocket-Key': 'Q/XBLi58n6ZNzzCoUr6JDg==',
'Sec-WebSocket-Version': '13',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36',
'Pragma': 'no-cache',
'Upgrade': 'websocket',
})
# Then create a connection to the tunnel
ws = create_connection(
'dfsfsfds',headers=headers)
# Here you will view the message return from the tunnel
while True:
pprint.pprint(json.loads(ws.recv()))
возвращает
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers)
websocket._exceptions.WebSocketBadStatusException: Handshake status 409 Conflict
Почему это происходит? У этого также websocket также есть токен доступа. Должен ли я использовать это?