Skip to content

Commit 05f5ebf

Browse files
committed
FIX: Fix incorrect error message on start()
1 parent 7b63ae3 commit 05f5ebf

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.16.1 - TBD
4+
5+
#### Bug fixes
6+
- Fixed an issue where starting a `Live` client before subscribing gave an incorrect error message
7+
38
## 0.16.0 - 2023-07-25
49

510
This release includes updates to the fields in text encodings (CSV and JSON), you can read more about the changes [here](https://databento.com/blog/CSV-JSON-updates-july-2023).

databento/live/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def start(
357357
ValueError
358358
If `start()` is called before a subscription has been made.
359359
If `start()` is called after streaming has already started.
360+
If `start()` is called after the live session has closed.
360361
361362
See Also
362363
--------
@@ -365,6 +366,8 @@ def start(
365366
"""
366367
logger.info("starting live client")
367368
if not self.is_connected():
369+
if self.dataset == "":
370+
raise ValueError("cannot start a live client without a subscription")
368371
raise ValueError("cannot start a live client after it is closed")
369372
if self._session.is_started():
370373
raise ValueError("client is already started")

databento/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.16.0"
1+
__version__ = "0.16.1"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "databento"
3-
version = "0.16.0"
3+
version = "0.16.1"
44
description = "Official Python client library for Databento"
55
authors = [
66
"Databento <[email protected]>",

tests/test_live_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ def test_live_start_twice(
309309
with pytest.raises(ValueError):
310310
live_client.start()
311311

312+
def test_live_start_before_subscribe(
313+
live_client: client.Live,
314+
) -> None:
315+
"""
316+
Test that calling start() before subscribe raises a ValueError.
317+
"""
318+
with pytest.raises(ValueError):
319+
live_client.start()
312320

313321
@pytest.mark.parametrize(
314322
"schema",

0 commit comments

Comments
 (0)