---
sidebar:
  hidden: true
title: roboto.formats.mcap.fetch
---
## Module Contents

### open_for_window()

```python
def roboto.formats.mcap.fetch.open_for_window(
    signed_url: str,
    start_time: Optional[int] = None,
    end_time: Optional[int] = None,
    topic_name: Optional[str] = None,
) -> roboto.storage.HttpRangeReader
```

`from roboto.formats.mcap import open_for_window`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/formats/mcap/fetch.py#L16-L83)

Open a remote MCAP file for reading, prefetching only the chunks in a log-time window and of one topic.

Reads the file's summary section to locate its chunk index, then prefetches in parallel each chunk whose message log times intersect `[start_time, end_time)` and, given a `topic_name`, whose chunk index lists a message index for a channel of that topic. Later reads of those chunks are answered from the reader's in-memory cache. The returned reader is positioned at the start of the file. The caller owns it and must [`close()`](/reference/python-sdk/roboto/storage/http_range_reader#roboto.storage.http_range_reader.HttpRangeReader.close) it.

The window is matched against the chunk index's log-time bounds; when row timestamps come from somewhere other than the message log time, pass no bounds (prefetching then covers every chunk) and filter rows after decode.

[`McapReader`](/reference/python-sdk/roboto/formats/mcap/reader#roboto.formats.mcap.reader.McapReader) reads through `mcap.reader.SeekingReader.iter_messages()`, which picks chunks for a window and topic by the same log-time and channel rules, with one addition: when given topics, it also reads a chunk whose chunk index names no message index, since that chunk's topics are unknown until it is scanned. This function does not prefetch such a chunk, so its bytes are downloaded when it is read.

**Parameters**

- **signed_url** (`str`): Resolved download URL of the MCAP file.
- **start_time** (`Optional[int]`): Inclusive window lower bound in nanoseconds, or `None` for unbounded.
- **end_time** (`Optional[int]`): Exclusive window upper bound in nanoseconds, or `None` for unbounded.
- **topic_name** (`Optional[str]`): Prefetch only the chunks holding a message on an MCAP channel of this topic, or chunks of every topic when `None`.

**Returns**

- `roboto.storage.HttpRangeReader`: An [`HttpRangeReader`](/reference/python-sdk/roboto/storage/http_range_reader#roboto.storage.http_range_reader.HttpRangeReader) over the file, primed with the selected chunks' bytes and positioned at offset 0.
