File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
doc/api/next_api_changes/deprecations Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 11``imread() `` reading from URLs
22~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
4- Passing a URL to `~.pyplot.imread() ` is deprecated. Please open the URL before
5- reading using ``urllib.request.urlopen() ``.
4+ Passing a URL to `~.pyplot.imread() ` is deprecated. Please open the URL for
5+ reading and directly use the Pillow API
6+ (``PIL.Image.open(urllib.request.urlopen(url)) ``, or
7+ ``PIL.Image.open(io.BytesIO(requests.get(url).content)) ``) instead.
Original file line number Diff line number Diff line change @@ -1431,8 +1431,9 @@ def imread(fname, format=None):
14311431 The image file to read: a filename, a URL or a file-like object opened
14321432 in read-binary mode.
14331433
1434- Passing a URL is deprecated. Please open the URL before reading using
1435- ``urllib.request.urlopen()``.
1434+ Passing a URL is deprecated. Please open the URL
1435+ for reading and pass the result to Pillow, e.g. with
1436+ ``PIL.Image.open(urllib.request.urlopen(url))``.
14361437 format : str, optional
14371438 The image file format assumed for reading the data. If not
14381439 given, the format is deduced from the filename. If nothing can
@@ -1479,8 +1480,9 @@ def imread(fname, format=None):
14791480 if len (parsed .scheme ) > 1 : # Pillow doesn't handle URLs directly.
14801481 cbook .warn_deprecated (
14811482 "3.4" , message = "Directly reading images from URLs is "
1482- "deprecated. Please open the URL before "
1483- "reading using urllib.request.urlopen()." )
1483+ "deprecated. Please open the URL for reading and pass the "
1484+ "result to Pillow, e.g. with "
1485+ "``PIL.Image.open(urllib.request.urlopen(url))``." )
14841486 # hide imports to speed initial import on systems with slow linkers
14851487 from urllib import request
14861488 ssl_ctx = mpl ._get_ssl_context ()
You can’t perform that action at this time.
0 commit comments