-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
Documentation
The documentation for urllib.request
uses urlopen()
3 times without either with
or manual closing. Although technically possible, this is not recommended.
It is also possible to achieve the same result without using the context manager approach.
>>> import urllib.request >>> f = urllib.request.urlopen('http://www.python.org/') >>> print(f.read(100).decode('utf-8'))
...
Use of Basic HTTP Authentication:urllib.request.urlopen('http://www.example.com/login.html')
...
Adding HTTP headers:r = urllib.request.urlopen(req)
This is a follow-up from ruff #13683.
Linked PRs
serhiy-storchaka
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Projects
Status
Todo