Skip to content

Commit

Permalink
add deprecation notice to get_messages
Browse files Browse the repository at this point in the history
  • Loading branch information
james-rms committed Oct 3, 2023
1 parent 52242b2 commit 2629d41
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions foxglove_data_platform/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ def get_messages(
"""
Returns a list of tuples of (topic, raw mcap record, decoded message).
.. deprecated:: 0.13.0
Use :func:`iter_messages` instead.
device_id: The id of the device that originated the desired data.
device_name: The name of the device that originated the desired data.
start: The earliest time from which to retrieve data.
Expand All @@ -299,10 +302,6 @@ def get_messages(
decoder_factories: an optional list of :py:class:`~mcap.decoder.DecoderFactory` instances
used to decode message content.
"""
if device_id is None and device_name is None:
raise RuntimeError(
"device_id or device_name must be provided to get_messages"
)
data = self.download_data(
device_name=device_name,
device_id=device_id,
Expand Down Expand Up @@ -340,7 +339,6 @@ def iter_messages(
decoder_factories: an optional list of :py:class:`~mcap.decoder.DecoderFactory` instances
used to decode message content.
"""

stream_link = self._make_stream_link(
device_id=device_id,
device_name=device_name,
Expand Down Expand Up @@ -397,6 +395,9 @@ def _make_stream_link(
topics: List[str] = [],
output_format: OutputFormat = OutputFormat.mcap0,
) -> str:
if device_id is None and device_name is None:
raise RuntimeError("device_id or device_name must be provided")

params = {
"device.id": device_id,
"device.name": device_name,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_stream_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def get_generated_data(url, **kwargs):
class Resp:
def __init__(self):
self.raw = BytesIO(generate_json_data())

def raise_for_status(self):
return None

return Resp()


@patch("requests.get", side_effect=get_generated_data)
def test_boot(arg):
Expand Down

0 comments on commit 2629d41

Please sign in to comment.