Skip to content

Commit

Permalink
Add block to specifically catch connection errors
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Aug 9, 2020
1 parent bc37c60 commit db080bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/html/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,10 @@ archives are built with identical packages.
to use such a package, see :ref:`Controlling
setup_requires<controlling-setup-requires>`.

.. _`Using pip from your program`:
Fixing network errors
=====================

TODO

Fixing conflicting dependencies
===============================
Expand Down
10 changes: 10 additions & 0 deletions src/pip/_internal/index/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,16 @@ def _get_html_page(link, session=None):
except SSLError as exc:
reason = "There was a problem confirming the ssl certificate"
logger.warning("Could not fetch URL %s: %s: %s", link, reason, exc)
except requests.ConnectTimeout:
template = (
"Skipping URL %s since the connection timed out. This is likely "
"caused by a misconfigured network."
)
logger.warning(template, link)
logger.warning(
"For help, visit "
"https://pip.pypa.io/en/latest/user_guide/#fixing-network-errors"
)
except requests.ConnectionError as exc:
reason = "connection error"
logger.warning("Could not fetch URL %s: %s: %s", link, reason, exc)
Expand Down

0 comments on commit db080bd

Please sign in to comment.