mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
17 lines
419 B
Python
17 lines
419 B
Python
|
"""Download files with progress indicators.
|
||
|
"""
|
||
|
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||
|
|
||
|
if MYPY_CHECK_RUNNING:
|
||
|
from typing import Optional
|
||
|
|
||
|
from pip._vendor.requests.models import Response
|
||
|
|
||
|
|
||
|
def _get_http_response_size(resp):
|
||
|
# type: (Response) -> Optional[int]
|
||
|
try:
|
||
|
return int(resp.headers['content-length'])
|
||
|
except (ValueError, KeyError, TypeError):
|
||
|
return None
|