Documentation
urllib.request.install_opener sets urllib.request._opener to the supplied value:
|
def install_opener(opener): |
|
global _opener |
|
_opener = opener |
And urllib.request.urlcleanup sets urllib.requests._opener to None, thus essentially uninstalling any previously installed global opener:
|
def urlcleanup(): |
|
"""Clean up temporary files from urlretrieve calls.""" |
|
for temp_file in _url_tempfiles: |
|
try: |
|
os.unlink(temp_file) |
|
except OSError: |
|
pass |
|
|
|
del _url_tempfiles[:] |
|
global _opener |
|
if _opener: |
|
_opener = None |
However, this uninstallation of a previously installed global opener is not documented.
If the uninstallation of openers installed with install_opener is intended, then it would be best to document it in urlcleanup, and if it is not intended this should be a bug instead of a doc issue.
Linked PRs
Documentation
urllib.request.install_openersetsurllib.request._openerto the supplied value:cpython/Lib/urllib/request.py
Lines 217 to 219 in 90f1d77
And
urllib.request.urlcleanupsetsurllib.requests._openertoNone, thus essentially uninstalling any previously installed global opener:cpython/Lib/urllib/request.py
Lines 282 to 293 in 90f1d77
However, this uninstallation of a previously installed global opener is not documented.
If the uninstallation of openers installed with
install_openeris intended, then it would be best to document it inurlcleanup, and if it is not intended this should be a bug instead of a doc issue.Linked PRs