From 1b0517e68b872a6ba5171261198c0e9d9bed58c4 Mon Sep 17 00:00:00 2001 From: Srinivas Nyayapati Date: Mon, 31 Aug 2020 11:27:34 -0400 Subject: [PATCH 1/2] Add documentation for netrc support --- docs/html/user_guide.rst | 27 +++++++++++++++++++++++++++ news/7231.doc | 1 + 2 files changed, 28 insertions(+) create mode 100644 news/7231.doc diff --git a/docs/html/user_guide.rst b/docs/html/user_guide.rst index b92e8b0a3..61dfaf0d5 100644 --- a/docs/html/user_guide.rst +++ b/docs/html/user_guide.rst @@ -79,6 +79,31 @@ as the "username" and do not provide a password, for example - ``https://0123456789abcdef@pypi.company.com`` +netrc Support +------------- + +If no credentials are part of the URL, pip will attempt to get authentication credentials +for the URL’s hostname from the user’s .netrc file. This behaviour comes from the underlying +use of `requests`_ which in turn delegates it to the `Python standard library`_. + +The .netrc file contains login and initialization information used by the auto-login process. +It resides in the user's home directory. The .netrc file format is simple. You specify lines +with a machine name and follow that with lines for the login and password that are +associated with that machine. Machine name is the hostname in your URL. + +An example .netrc for the host example.com with a user named 'daniel', using the password +'qwerty' would look like: + +.. code-block:: shell + + machine example.com + login daniel + password qwerty + +As mentioned in the `standard library docs `_, +whitespace and non-printable characters are not allowed in passwords. + + Keyring Support --------------- @@ -1296,3 +1321,5 @@ announcements on the `low-traffic packaging announcements list`_ and .. _low-traffic packaging announcements list: https://mail.python.org/mailman3/lists/pypi-announce.python.org/ .. _our survey on upgrades that create conflicts: https://docs.google.com/forms/d/e/1FAIpQLSeBkbhuIlSofXqCyhi3kGkLmtrpPOEBwr6iJA6SzHdxWKfqdA/viewform .. _the official Python blog: https://blog.python.org/ +.. _requests: https://requests.readthedocs.io/en/master/user/authentication/#netrc-authentication +.. _Python standard library: https://docs.python.org/3/library/netrc.html diff --git a/news/7231.doc b/news/7231.doc new file mode 100644 index 000000000..bef9bf3e6 --- /dev/null +++ b/news/7231.doc @@ -0,0 +1 @@ +Add documentation for '.netrc' support. From 8e622390d06cafb4d179152ed19d23d81aed45f4 Mon Sep 17 00:00:00 2001 From: Srinivas Nyayapati Date: Mon, 31 Aug 2020 11:43:26 -0400 Subject: [PATCH 2/2] mention using only ASCII for password --- docs/html/user_guide.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/html/user_guide.rst b/docs/html/user_guide.rst index 61dfaf0d5..3ef99e01b 100644 --- a/docs/html/user_guide.rst +++ b/docs/html/user_guide.rst @@ -101,7 +101,7 @@ An example .netrc for the host example.com with a user named 'daniel', using the password qwerty As mentioned in the `standard library docs `_, -whitespace and non-printable characters are not allowed in passwords. +only ASCII characters are allowed. Whitespace and non-printable characters are not allowed in passwords. Keyring Support