wherobots-python-dbapi 0.26.0__py3-none-any.whl → 0.26.1__py3-none-any.whl

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.
wherobots/db/driver.py CHANGED
@@ -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
 
@@ -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
@@ -3,14 +3,14 @@ wherobots/db/__init__.py,sha256=HN_uGOUMor80GB3rZIqnPcYWDAia7QAC-y9HfGKnegs,744
3
3
  wherobots/db/connection.py,sha256=BWQwVzFgujEwPKvhDePM9q45M2opCk6Jq998L0ekMyY,12795
4
4
  wherobots/db/constants.py,sha256=qV-6CmOya7-f-DoRMzcDzlhcmV5PkLCcqG5TFIsxQ7o,744
5
5
  wherobots/db/cursor.py,sha256=Z0rNdhJ985IP9XnZpjrCzvM0OqDFVgCNfJn8lrbijAo,6809
6
- wherobots/db/driver.py,sha256=J-ESQYLTOL0NYbOVVwsARXwECjVgVohg-aUA7Lv_ZrQ,7474
6
+ wherobots/db/driver.py,sha256=2DAkWSQQOijDY3Zbufbk7j8X0yYkrqhLU_kvrNa7P2s,8002
7
7
  wherobots/db/errors.py,sha256=G8a-DB6pgB0pUld59Wyq8PuywL-JWxGJfvrr-g8BPuU,310
8
8
  wherobots/db/models.py,sha256=uk0EqZMH_RFkQusSw2AvyFivGvGJBu_WYP8FHa6JJGM,4178
9
9
  wherobots/db/region.py,sha256=GoFzazvgOjE1kVVT1QKAsRK88c_1XSAebR3ME4foSlQ,400
10
10
  wherobots/db/runtime.py,sha256=eAR1oJEtssgkp-IRPTLOrlPI-_5SM_ASw6T6hQ_qF4I,985
11
11
  wherobots/db/session_type.py,sha256=jZNwCl0nxvY-0reIn8RR_-fIYSSvIcaGx_4pRc71Lww,137
12
12
  wherobots/db/types.py,sha256=WXKT_gbdQCH2_yXD_FECk0BpB7yfNWOLewCfax0U_Lk,2516
13
- wherobots_python_dbapi-0.26.0.dist-info/METADATA,sha256=iBhvIP-JgBLJgV4Fd1HCcAJjd2jbKIeXRA0439Tg-38,10328
14
- wherobots_python_dbapi-0.26.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
15
- wherobots_python_dbapi-0.26.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
16
- wherobots_python_dbapi-0.26.0.dist-info/RECORD,,
13
+ wherobots_python_dbapi-0.26.1.dist-info/METADATA,sha256=ILRnl_hGC_RlRgzuttJxSw9ubkJMAjVMVmMEb8G8V-M,10328
14
+ wherobots_python_dbapi-0.26.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
15
+ wherobots_python_dbapi-0.26.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
16
+ wherobots_python_dbapi-0.26.1.dist-info/RECORD,,