"""xmlrpclib.Transport implementation """ import logging # NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is # why we ignore the type on this import from pip._vendor.six.moves import xmlrpc_client # type: ignore from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._internal.exceptions import NetworkConnectionError from pip._internal.network.utils import raise_for_status from pip._internal.utils.typing import MYPY_CHECK_RUNNING if MYPY_CHECK_RUNNING: from typing import Dict from pip._internal.network.session import PipSession logger = logging.getLogger(__name__) class PipXmlrpcTransport(xmlrpc_client.Transport): """Provide a `xmlrpclib.Transport` implementation via a `PipSession` object. """ def __init__(self, index_url, session, use_datetime=False): # type: (str, PipSession, bool) -> None xmlrpc_client.Transport.__init__(self, use_datetime) index_parts = urllib_parse.urlparse(index_url) self._scheme = index_parts.scheme self._session = session def request(self, host, handler, request_body, verbose=False): # type: (str, str, Dict[str, str], bool) -> None parts = (self._scheme, host, handler, None, None, None) url = urllib_parse.urlunparse(parts) try: headers = {'Content-Type': 'text/xml'} response = self._session.post(url, data=request_body, headers=headers, stream=True) raise_for_status(response) self.verbose = verbose return self.parse_response(response.raw) except NetworkConnectionError as exc: assert exc.response logger.critical( "HTTP error %s while getting %s", exc.response.status_code, url, ) raise
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
.__init__.pyo.40009 | File | 232 B | 0644 |
|
.session.pyo.40009 | File | 11.58 KB | 0644 |
|
.utils.pyo.40009 | File | 1.74 KB | 0644 |
|
__init__.py | File | 50 B | 0644 |
|
__init__.pyc | File | 232 B | 0644 |
|
__init__.pyo | File | 232 B | 0644 |
|
auth.py | File | 11.38 KB | 0644 |
|
auth.pyc | File | 8.48 KB | 0644 |
|
auth.pyo | File | 8.27 KB | 0644 |
|
cache.py | File | 2.27 KB | 0644 |
|
cache.pyc | File | 3.39 KB | 0644 |
|
cache.pyo | File | 3.3 KB | 0644 |
|
download.py | File | 5.03 KB | 0644 |
|
download.pyc | File | 5.77 KB | 0644 |
|
download.pyo | File | 5.73 KB | 0644 |
|
lazy_wheel.py | File | 7.95 KB | 0644 |
|
lazy_wheel.pyc | File | 9.87 KB | 0644 |
|
lazy_wheel.pyo | File | 9.81 KB | 0644 |
|
session.py | File | 14.85 KB | 0644 |
|
session.pyc | File | 11.58 KB | 0644 |
|
session.pyo | File | 11.58 KB | 0644 |
|
utils.py | File | 4.07 KB | 0644 |
|
utils.pyc | File | 1.74 KB | 0644 |
|
utils.pyo | File | 1.74 KB | 0644 |
|
xmlrpc.py | File | 1.84 KB | 0644 |
|
xmlrpc.pyc | File | 2.27 KB | 0644 |
|
xmlrpc.pyo | File | 2.24 KB | 0644 |
|