balatrobot 0.7.2__py3-none-any.whl → 0.7.4__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.
balatrobot/__init__.py CHANGED
@@ -5,7 +5,7 @@ from .enums import Actions, Decks, Stakes, State
5
5
  from .exceptions import BalatroError
6
6
  from .models import G
7
7
 
8
- __version__ = "0.7.2"
8
+ __version__ = "0.7.4"
9
9
  __all__ = [
10
10
  # Main client
11
11
  "BalatroClient",
balatrobot/client.py CHANGED
@@ -6,6 +6,7 @@ import platform
6
6
  import re
7
7
  import shutil
8
8
  import socket
9
+ import time
9
10
  from pathlib import Path
10
11
  from typing import Self
11
12
 
@@ -186,6 +187,9 @@ class BalatroClient:
186
187
  logger.debug(f"Sending API request: {name}")
187
188
 
188
189
  try:
190
+ # Start timing measurement
191
+ start_time = time.perf_counter()
192
+
189
193
  # Send request
190
194
  message = request.model_dump_json() + "\n"
191
195
  self._socket.send(message.encode())
@@ -216,6 +220,18 @@ class BalatroClient:
216
220
  logger.debug(f"API request {name} completed successfully")
217
221
  return response_data
218
222
 
223
+ except socket.timeout as e:
224
+ # Calculate elapsed time and log timeout
225
+ elapsed_time = time.perf_counter() - start_time
226
+ logger.warning(
227
+ f"Timeout on API request {name}: took {elapsed_time:.3f}s, "
228
+ f"exceeded timeout of {self.timeout}s (port: {self.port})"
229
+ )
230
+ raise ConnectionFailedError(
231
+ f"Socket timeout during communication: {e}",
232
+ error_code="E008",
233
+ context={"error": str(e), "elapsed_time": elapsed_time},
234
+ ) from e
219
235
  except socket.error as e:
220
236
  logger.error(f"Socket error during API request {name}: {e}")
221
237
  raise ConnectionFailedError(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: balatrobot
3
- Version: 0.7.2
3
+ Version: 0.7.4
4
4
  Summary: A framework for Balatro bot development
5
5
  Project-URL: Homepage, https://github.com/coder/balatrobot
6
6
  Project-URL: Issues, https://github.com/coder/balatrobot/issues
@@ -0,0 +1,10 @@
1
+ balatrobot/__init__.py,sha256=sn-gdztWJAELq4WCWhtOQVIu3r4fguVwb9YP6JEn4TU,406
2
+ balatrobot/client.py,sha256=pXPKmTh3hQpt0wMQG9wZSNFD47x-pwHbqspndjApAcE,18664
3
+ balatrobot/enums.py,sha256=UzlrljX1x_UlbuqR87c-KrCQjS74DGpG8A0zH0G-h98,22463
4
+ balatrobot/exceptions.py,sha256=fRupkYMw4PuMCJd8SFjfBDlla8wiKwhVzLj8AxmVL9I,4046
5
+ balatrobot/models.py,sha256=me9-qN1LQtnWfReC8tF8DFR38d5hBBSJD1SfUF3d2b4,14996
6
+ balatrobot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ balatrobot-0.7.4.dist-info/METADATA,sha256=iFVGpa27v74dlCNe9ix5qEHTVq9WDjYCL-6GpFUp_EM,2801
8
+ balatrobot-0.7.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ balatrobot-0.7.4.dist-info/licenses/LICENSE,sha256=71EXhU7CSe-Cihhj_VVxLtgVnSOaavHqVoixPKtE7Bk,1064
10
+ balatrobot-0.7.4.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- balatrobot/__init__.py,sha256=NPN0CoMyGSNTtHHhH7JvgoKHsgRAV7zBNYadQt9SsZY,406
2
- balatrobot/client.py,sha256=qx9EMkZEbZahd6wirontmxslmwejgdMTUW87GCzcYh8,17993
3
- balatrobot/enums.py,sha256=UzlrljX1x_UlbuqR87c-KrCQjS74DGpG8A0zH0G-h98,22463
4
- balatrobot/exceptions.py,sha256=fRupkYMw4PuMCJd8SFjfBDlla8wiKwhVzLj8AxmVL9I,4046
5
- balatrobot/models.py,sha256=me9-qN1LQtnWfReC8tF8DFR38d5hBBSJD1SfUF3d2b4,14996
6
- balatrobot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- balatrobot-0.7.2.dist-info/METADATA,sha256=8tRZGA7DxWD9ij8SKkZmw6uwiKP4bnqxFUjBplnx8Uo,2801
8
- balatrobot-0.7.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
- balatrobot-0.7.2.dist-info/licenses/LICENSE,sha256=71EXhU7CSe-Cihhj_VVxLtgVnSOaavHqVoixPKtE7Bk,1064
10
- balatrobot-0.7.2.dist-info/RECORD,,