wherobots-python-dbapi 0.26.0__tar.gz → 0.26.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/PKG-INFO +1 -1
  2. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/pyproject.toml +1 -1
  3. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/driver.py +21 -4
  4. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/.gitignore +0 -0
  5. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/LICENSE +0 -0
  6. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/README.md +0 -0
  7. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/__init__.py +0 -0
  8. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/__init__.py +0 -0
  9. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/connection.py +0 -0
  10. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/constants.py +0 -0
  11. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/cursor.py +0 -0
  12. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/errors.py +0 -0
  13. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/models.py +0 -0
  14. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/region.py +0 -0
  15. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/runtime.py +0 -0
  16. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/session_type.py +0 -0
  17. {wherobots_python_dbapi-0.26.0 → wherobots_python_dbapi-0.26.1}/wherobots/db/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wherobots-python-dbapi
3
- Version: 0.26.0
3
+ Version: 0.26.1
4
4
  Summary: Python DB-API driver for Wherobots DB
5
5
  Project-URL: Homepage, https://github.com/wherobots/wherobots-python-dbapi-driver
6
6
  Project-URL: Tracker, https://github.com/wherobots/wherobots-python-dbapi-driver/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "wherobots-python-dbapi"
3
- version = "0.26.0"
3
+ version = "0.26.1"
4
4
  description = "Python DB-API driver for Wherobots DB"
5
5
  authors = [{ name = "Maxime Petazzoni", email = "max@wherobots.com" }]
6
6
  requires-python = ">=3.10, <4"
@@ -13,6 +13,7 @@ import requests
13
13
  import tenacity
14
14
  from typing import Final, Union, Dict
15
15
  import urllib.parse
16
+ import websockets.exceptions
16
17
  import websockets.sync.client
17
18
  import certifi
18
19
 
@@ -200,17 +201,33 @@ def connect_direct(
200
201
  geometry_representation: Union[GeometryRepresentation, None] = None,
201
202
  ) -> Connection:
202
203
  uri_with_protocol = f"{uri}/{protocol}"
204
+ ssl_context = ssl.create_default_context()
205
+ ssl_context.load_verify_locations(certifi.where())
203
206
 
204
- try:
207
+ @tenacity.retry(
208
+ stop=tenacity.stop_after_attempt(5),
209
+ wait=tenacity.wait_exponential(multiplier=1, min=1, max=5),
210
+ retry=tenacity.retry_if_exception_type(
211
+ (
212
+ ConnectionRefusedError,
213
+ ConnectionResetError,
214
+ TimeoutError,
215
+ websockets.exceptions.InvalidHandshake,
216
+ )
217
+ ),
218
+ reraise=True,
219
+ )
220
+ def ws_connect() -> websockets.sync.client.ClientConnection:
205
221
  logging.info("Connecting to SQL session at %s ...", uri_with_protocol)
206
- ssl_context = ssl.create_default_context()
207
- ssl_context.load_verify_locations(certifi.where())
208
- ws = websockets.sync.client.connect(
222
+ return websockets.sync.client.connect(
209
223
  uri=uri_with_protocol,
210
224
  additional_headers=headers,
211
225
  max_size=MAX_MESSAGE_SIZE,
212
226
  ssl=ssl_context,
213
227
  )
228
+
229
+ try:
230
+ ws = ws_connect()
214
231
  except Exception as e:
215
232
  raise InterfaceError("Failed to connect to SQL session!") from e
216
233