MCPcopy
hub / github.com/microsoft/playwright-python / body

Method body

playwright/_impl/_fetch.py:534–552  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

532 return self._headers.headers_array()
533
534 async def body(self) -> bytes:
535 try:
536 result = await self._request._connection.wrap_api_call(
537 lambda: self._request._channel.send_return_as_dict(
538 "fetchResponseBody",
539 None,
540 {
541 "fetchUid": self._fetch_uid,
542 },
543 ),
544 True,
545 )
546 if result is None:
547 raise Error("Response has been disposed")
548 return base64.b64decode(result["binary"])
549 except Error as exc:
550 if is_target_closed_error(exc):
551 raise Error("Response has been disposed")
552 raise exc
553
554 async def text(self) -> str:
555 content = await self.body()

Callers 1

textMethod · 0.95

Calls 4

is_target_closed_errorFunction · 0.90
ErrorClass · 0.85
wrap_api_callMethod · 0.80
send_return_as_dictMethod · 0.80

Tested by

no test coverage detected