Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
xmlrpc.py
Go to the documentation of this file.
1"""xmlrpclib.Transport implementation
2"""
3
4import logging
5import urllib.parse
6import xmlrpc.client
7from typing import TYPE_CHECKING, Tuple
8
9from pip._internal.exceptions import NetworkConnectionError
10from pip._internal.network.session import PipSession
11from pip._internal.network.utils import raise_for_status
12
13if TYPE_CHECKING:
14 from xmlrpc.client import _HostType, _Marshallable
15
16logger = logging.getLogger(__name__)
17
18
20 """Provide a `xmlrpclib.Transport` implementation via a `PipSession`
21 object.
22 """
23
25 self, index_url: str, session: PipSession, use_datetime: bool = False
26 ) -> None:
27 super().__init__(use_datetime)
28 index_parts = urllib.parse.urlparse(index_url)
30 self._session = session
31
32 def request(
33 self,
34 host: "_HostType",
35 handler: str,
36 request_body: bytes,
37 verbose: bool = False,
38 ) -> Tuple["_Marshallable", ...]:
39 assert isinstance(host, str)
40 parts = (self._scheme, host, handler, None, None, None)
41 url = urllib.parse.urlunparse(parts)
42 try:
43 headers = {"Content-Type": "text/xml"}
44 response = self._session.post(
45 url,
46 data=request_body,
47 headers=headers,
48 stream=True,
49 )
50 raise_for_status(response)
51 self.verbose = verbose
52 return self.parse_response(response.raw)
53 except NetworkConnectionError as exc:
54 assert exc.response
56 "HTTP error %s while getting %s",
58 url,
59 )
60 raise
None __init__(self, str index_url, PipSession session, bool use_datetime=False)
Definition xmlrpc.py:26
for i