gh-141444:fix broken URLs and examples in urllib.request.rst#144863
Open
tangyuan0821 wants to merge 2 commits intopython:mainfrom
Open
gh-141444:fix broken URLs and examples in urllib.request.rst#144863tangyuan0821 wants to merge 2 commits intopython:mainfrom
tangyuan0821 wants to merge 2 commits intopython:mainfrom
Conversation
Doc/library/urllib.request.rst
Outdated
| >>> with urllib.request.urlopen('https://www.python.org/') as f: | ||
| ... print(f.read(300)) | ||
| ... | ||
| b'<!doctype html>\n<!--[if lt IE 7]> <html class="no-js ie6 lt-ie7 lt-ie8 lt-ie9"> <![endif]-->\n<!--[if IE 7]> <html class="no-js ie7 lt-ie8 lt-ie9"> <![endif]-->\n<!--[if IE 8]> <html class="no-js ie8 lt-ie9"> |
Member
There was a problem hiding this comment.
This example doesn’t work like this any more, the content gzip compressed:
... with urllib.request.urlopen("https://www.python.org/") as f:
... print(f.headers["Content-Encoding"])
...
gzip
Contributor
Author
There was a problem hiding this comment.
Thanks, I'll update it right away.
Contributor
Author
There was a problem hiding this comment.
This example doesn’t work like this any more, the content gzip compressed:
... with urllib.request.urlopen("https://www.python.org/") as f: ... print(f.headers["Content-Encoding"]) ... gzip
I have made the revisions. Could you please confirm if this is what you wanted?
Doc/library/urllib.request.rst
Outdated
| >>> with urllib.request.urlopen('https://www.python.org/') as f: | ||
| ... print(f.read(100).decode('utf-8')) | ||
| ... | ||
| <!doctype html> |
Member
There was a problem hiding this comment.
Similarly for this one.
Doc/library/urllib.request.rst
Outdated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
musi‑cal.com→https://www.python.org,requestb.in→https://httpbin.org/postProxyHandler({}})→ProxyHandler({}), correct urlretrieve indentationurllib.request.rst📚 Documentation preview 📚: https://cpython-previews--144863.org.readthedocs.build/en/144863/library/urllib.request.html