MCPcopy Create free account
hub / github.com/apify/impit / text

Method text

impit-python/src/response.rs:448–459  ·  view source on GitHub ↗
(&mut self, py: Python<'_>)

Source from the content-addressed store, hash-verified

446
447 #[getter]
448 fn text(&mut self, py: Python<'_>) -> PyResult<String> {
449 if let Some(cached_text) = &self.text {
450 return Ok(cached_text.clone());
451 }
452
453 let content_bytes = self.read(py)?;
454 let decoder = encoding_from_whatwg_label(&self.encoding);
455 let decoded_text = impit::utils::decode(&content_bytes, decoder);
456
457 self.text = Some(decoded_text.clone());
458 Ok(decoded_text)
459 }
460
461 fn json(&mut self, py: Python<'_>) -> PyResult<Py<PyAny>> {
462 let text = self.text(py)?;

Callers 1

jsonMethod · 0.45

Calls 3

decodeFunction · 0.85
cloneMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected