| 168 | ) |
| 169 | |
| 170 | async def start_har( |
| 171 | self, |
| 172 | path: Union[pathlib.Path, str], |
| 173 | content: Literal["attach", "embed", "omit"] = None, |
| 174 | mode: Literal["full", "minimal"] = None, |
| 175 | urlFilter: Union[str, Pattern[str]] = None, |
| 176 | ) -> DisposableStub: |
| 177 | if self._har_id: |
| 178 | raise Error("HAR recording has already been started") |
| 179 | is_zip = str(path).endswith(".zip") |
| 180 | default_content: Literal["attach", "embed", "omit"] = ( |
| 181 | "attach" if is_zip else "embed" |
| 182 | ) |
| 183 | self._har_id = await self._record_into_har( |
| 184 | har=path, |
| 185 | page=None, |
| 186 | url=urlFilter, |
| 187 | update_content=content or default_content, |
| 188 | update_mode=mode or "full", |
| 189 | ) |
| 190 | return DisposableStub(lambda: self.stop_har(), self) |
| 191 | |
| 192 | async def _record_into_har( |
| 193 | self, |