MCPcopy Create free account
hub / github.com/0x676e67/wreq-python / encoding

Method encoding

src/client/async_impl/response/http.rs:111–124  ·  view source on GitHub ↗
(&self, py: Python)

Source from the content-addressed store, hash-verified

109 /// Encoding to decode with when accessing text.
110 #[getter]
111 pub fn encoding(&self, py: Python) -> String {
112 py.allow_threads(|| {
113 self.headers
114 .0
115 .get(header::CONTENT_TYPE)
116 .and_then(|value| value.to_str().ok())
117 .and_then(|value| value.parse::<Mime>().ok())
118 .and_then(|mime| {
119 mime.get_param("charset")
120 .map(|charset| charset.as_str().to_owned())
121 })
122 .unwrap_or_else(|| "utf-8".to_owned())
123 })
124 }
125
126 /// Returns the TLS peer certificate of the response.
127 pub fn peer_certificate<'py>(

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected