Skip to content

[DOC] urllib.request: Explain how works Basic HTTP Authentication #11637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

arugifa
Copy link

@arugifa arugifa commented Jan 21, 2019

The original example given in the doc, to manage Basic HTTP Authentication,
only works when the authentication mechanism is properly implemented by
the server.

However, very often, this is not the case. And the top-answers on Stackoverflow
recommend to bypass using password managers from urllib.request, and instead,
to manually encode the credentials in base64.

These answers have mostly been written before the introduction of
HTTPPasswordMgrWithPriorAuth, which is aimed to solve this problem.

By giving more explanations, directly in the Python documentation, about how
the Basic HTTP Authentication mechanism is working, we will avoid people to
copy/paste some outdated code snippet from Stackoverflow.

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

The original example given in the doc, to manage Basic HTTP Authentication,
only works when the authentication mechanism is properly implemented by
the server.

However, very often, this is not the case. And the top-answers on Stackoverflow
recommend to bypass using password managers from ``urllib.request``, and instead,
to manually encode the credentials in base64.

These answers have mostly been written before the introduction of
``HTTPPasswordMgrWithPriorAuth``, which is aimed to solve this problem.

By giving more explanations, directly in the Python documentation, about how
the Basic HTTP Authentication mechanism is working, we will avoid people to
copy/paste some outdated code snippet from Stackoverflow.
Copy link
Member

@orsenthil orsenthil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text seems to be using words like "you', "your" and in line 1244, there is a mistake with the phrase "After what,".

I recommend that the language be changed to how the rest of the document reads. The text can be simplified and written in an impersonal manner.

Like, "When a protected page is accessed, the server sends a 401 Unauthorized response..."

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@csabella
Copy link
Contributor

@arugifa, please address the review comments from @orsenthil. Thank you!

@csabella
Copy link
Contributor

@arugifa ping

@AlexWaygood
Copy link
Member

Changes were requested by a core dev over two years ago, but have not been made. I'm therefore closing this PR.

@arugifa, if you're still interested in working on this issue, please feel free to open a new PR. Alternatively, ping me, and I'll happily reopen this PR. Thanks! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants