diff --git a/README.md b/README.md
index af332e9..2f05e4f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Sydney.py
-[![Latest Release](https://img.shields.io/github/v/release/vsakkas/sydney.py.svg?color=blue)](https://github.com/vsakkas/sydney.py/releases/tag/v0.23.0)
+[![Latest Release](https://img.shields.io/github/v/release/vsakkas/sydney.py.svg?color=blue)](https://github.com/vsakkas/sydney.py/releases/tag/v0.23.1)
[![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![Managed](https://img.shields.io/badge/managed-poetry-bluegreen.svg?color=blue)](https://github.com/python-poetry/poetry)
[![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/vsakkas/sydney.py/blob/master/LICENSE)
diff --git a/poetry.lock b/poetry.lock
index 0699375..9ee8d4b 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1231,14 +1231,14 @@ markers = {main = "python_version < \"3.11\""}
[[package]]
name = "virtualenv"
-version = "20.29.0"
+version = "20.29.1"
description = "Virtual Python Environment builder"
optional = false
python-versions = ">=3.8"
groups = ["dev"]
files = [
- {file = "virtualenv-20.29.0-py3-none-any.whl", hash = "sha256:c12311863497992dc4b8644f8ea82d3b35bb7ef8ee82e6630d76d0197c39baf9"},
- {file = "virtualenv-20.29.0.tar.gz", hash = "sha256:6345e1ff19d4b1296954cee076baaf58ff2a12a84a338c62b02eda39f20aa982"},
+ {file = "virtualenv-20.29.1-py3-none-any.whl", hash = "sha256:4e4cb403c0b0da39e13b46b1b2476e505cb0046b25f242bee80f62bf990b2779"},
+ {file = "virtualenv-20.29.1.tar.gz", hash = "sha256:b8b8970138d32fb606192cb97f6cd4bb644fa486be9308fb9b63f81091b5dc35"},
]
[package.dependencies]
diff --git a/pyproject.toml b/pyproject.toml
index 4899fee..1956de8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sydney-py"
-version = "0.23.0"
+version = "0.23.1"
description = "Python Client for Copilot (formerly named Bing Chat), also known as Sydney."
authors = ["vsakkas "]
license = "MIT"
diff --git a/sydney/sydney.py b/sydney/sydney.py
index 6cfa443..b063aaf 100644
--- a/sydney/sydney.py
+++ b/sydney/sydney.py
@@ -7,9 +7,9 @@
from typing import AsyncGenerator
from urllib import parse
-import websockets.legacy.client as websockets
+import websockets.asyncio.client as websockets
from aiohttp import ClientSession, FormData, TCPConnector
-from websockets.legacy.client import WebSocketClientProtocol
+from websockets.asyncio.client import ClientConnection
from sydney.constants import (
BING_BLOB_URL,
@@ -94,7 +94,7 @@ def __init__(
self.invocation_id: int | None = None
self.number_of_messages: int | None = None
self.max_messages: int | None = None
- self.wss_client: WebSocketClientProtocol | None = None
+ self.wss_client: ClientConnection | None = None
self.session: ClientSession | None = None
async def __aenter__(self) -> SydneyClient:
@@ -365,7 +365,7 @@ async def _ask(
# Create a websocket connection with Copilot for sending and receiving messages.
try:
self.wss_client = await websockets.connect(
- bing_chathub_url, extra_headers=CHATHUB_HEADERS, max_size=None
+ bing_chathub_url, additional_headers=CHATHUB_HEADERS, max_size=None
)
except TimeoutError:
raise ConnectionTimeoutException(
@@ -786,7 +786,7 @@ async def close_conversation(self) -> None:
"""
Close all connections to Copilot. Clear conversation information.
"""
- if self.wss_client and not self.wss_client.closed:
+ if self.wss_client:
await self.wss_client.close()
self.wss_client = None