MCPcopy
hub / github.com/encode/httpx / __init__

Method __init__

httpx/_config.py:202–224  ·  httpx/_config.py::Proxy.__init__
(
        self,
        url: URL | str,
        *,
        ssl_context: ssl.SSLContext | None = None,
        auth: tuple[str, str] | None = None,
        headers: HeaderTypes | None = None,
    )

Source from the content-addressed store, hash-verified

200
201class Proxy:
202 def __init__(
203 self,
204 url: URL | str,
205 *,
206 ssl_context: ssl.SSLContext | None = None,
207 auth: tuple[str, str] | None = None,
208 headers: HeaderTypes | None = None,
209 ) -> None:
210 url = URL(url)
211 headers = Headers(headers)
212
213 if url.scheme not in (class="st">"http", class="st">"https", class="st">"socks5", class="st">"socks5h"):
214 raise ValueError(fclass="st">"Unknown scheme for proxy URL {url!r}")
215
216 if url.username or url.password:
217 class="cm"># Remove any auth credentials from the URL.
218 auth = (url.username, url.password)
219 url = url.copy_with(username=None, password=None)
220
221 self.url = url
222 self.auth = auth
223 self.headers = headers
224 self.ssl_context = ssl_context
225
226 @property
227 def raw_auth(self) -> tuple[bytes, bytes] | None:

Callers

nothing calls this directly

Calls 3

copy_withMethod · 0.95
URLClass · 0.85
HeadersClass · 0.85

Tested by

no test coverage detected